我有一个非常基本的问题。我有一个大型的工作簿,有很多列出的信息。我想将一些信息提取到一个新的工作簿中,并将其排序在不同的工作表上。我在使代码了解我希望将信息放入哪个选项卡时遇到了一些问题。 strName = Range(单元格值)不起作用,我不知道自己做错了什么。我怎样才能做到这一点?对于非常混乱的代码抱歉。将一个工作簿中的值排序到另一个工作簿中的正确工作表中
Private Sub CommandButton1_Click()
Dim strName As String
Set sourceWq = Workbooks("SD KPIs 2014 onwards").Worksheets("VQN+Concessionn")
Set front = Workbooks("databank progging").Worksheets("Frontpage")
For l = 5 To 30
For i = 2 To 250000 'Goes through the sourceWq workbook
If front.Cells(l, 13).Value = sourceWq.Cells(i, 24).Value Then 'Finds correct supplier
strName = Range("l,13")
Sheets(strName).Select 'Selects the correct worksheet for the supplier
For j = 4 To 15 'Month
If sourceWq.Cells(i, 33).Value = Cells(7, j).Value Then
For n = 8 To 11 'The type of NCR
If sourceWq.Cells(i, 27).Value = Cells(n, 2).Value Then
Cells(n, j).Value = Cells(n, j).Value + 1
Else: End If
Next n
Else: End If
Next j
Else: End If
Next i
Next l
End Sub
什么工作簿('sourceWq'或'front')你的'strName'位于? –
同样的问题到'Sheets(strName).Select'。在你想要选择工作表的工作簿中? –