L
Lindy
Help pls. Am getting an error 1004 Application defined or Object defined
error. I have looked at the other posts with the same error but I cannot
seem to be able to correct my problem. The Do While line is being flagged as
the problem. Do I need to select the worksheet first? If so what is the
right code for doing that with the ThisWorkbook object
Dim bk2 As Workbook
Set bk2 = Workbooks.Open(Filename:=fileToOpen)
With ThisWorkbook.Sheets("fdbpre")
RowCount = 1
Do While .Range("CU" & RowCount) <> " "
MON = .Range("CU" & RowCount)
With bk2.Sheets("Sheet1")
Set c = .Columns("A").Find(what:=MON, LookIn:=xlValues, lookat:=xlWhole)
End With
If Not c Is Nothing Then
.Range("EG" & RowCount) = .Range("CB" & RowCount) * c.Offset(0, 1)
End If
RowCount = 1 = RowCount = 1 + 1
Loop
End With
error. I have looked at the other posts with the same error but I cannot
seem to be able to correct my problem. The Do While line is being flagged as
the problem. Do I need to select the worksheet first? If so what is the
right code for doing that with the ThisWorkbook object
Dim bk2 As Workbook
Set bk2 = Workbooks.Open(Filename:=fileToOpen)
With ThisWorkbook.Sheets("fdbpre")
RowCount = 1
Do While .Range("CU" & RowCount) <> " "
MON = .Range("CU" & RowCount)
With bk2.Sheets("Sheet1")
Set c = .Columns("A").Find(what:=MON, LookIn:=xlValues, lookat:=xlWhole)
End With
If Not c Is Nothing Then
.Range("EG" & RowCount) = .Range("CB" & RowCount) * c.Offset(0, 1)
End If
RowCount = 1 = RowCount = 1 + 1
Loop
End With