Hello all,
Please help with an "runtime error 1004 method range of object _global failed" error, that i recieve in this vba. I have around 10 more VBAs before this one, none of them return an error, but this one (they are identical, only page numbers a different):
=============================================
Sub actualizare()
Dim lastRw1, lastRw2, nxtRw, m
Dim StartRow, x
Dim StartDate As String
Dim FndRw As String
lastRw1 = Sheets(11).Range("B" & Rows.Count).End(xlUp).Row
StartDate = Range("908!A21").Value
For StartRow = 1 To lastRw1
If Range("19_01!B" & StartRow).Value = StartDate Then
FndRw = StartRow
Exit For
End If
Next
Range("19_01!AM" & FndRw & ":AM" & lastRw1).ClearContents
lastRw2 = Sheets(15).Range("A" & Rows.Count).End(xlUp).Row
For nxtRw = 1 To lastRw2
With Sheets(11).Range("B2000:B" & lastRw1)
Set m = .Find(Sheets(15).Range("A" & nxtRw), lookat:=xlWhole)
If Not m Is Nothing Then
Sheets(15).Range("B" & nxtRw).Copy _
Sheets(11).Range("AM" & m.Row)
End If
End With
Next
End Sub
=============================================
Thank you!
Please help with an "runtime error 1004 method range of object _global failed" error, that i recieve in this vba. I have around 10 more VBAs before this one, none of them return an error, but this one (they are identical, only page numbers a different):
=============================================
Sub actualizare()
Dim lastRw1, lastRw2, nxtRw, m
Dim StartRow, x
Dim StartDate As String
Dim FndRw As String
lastRw1 = Sheets(11).Range("B" & Rows.Count).End(xlUp).Row
StartDate = Range("908!A21").Value
For StartRow = 1 To lastRw1
If Range("19_01!B" & StartRow).Value = StartDate Then
FndRw = StartRow
Exit For
End If
Next
Range("19_01!AM" & FndRw & ":AM" & lastRw1).ClearContents
lastRw2 = Sheets(15).Range("A" & Rows.Count).End(xlUp).Row
For nxtRw = 1 To lastRw2
With Sheets(11).Range("B2000:B" & lastRw1)
Set m = .Find(Sheets(15).Range("A" & nxtRw), lookat:=xlWhole)
If Not m Is Nothing Then
Sheets(15).Range("B" & nxtRw).Copy _
Sheets(11).Range("AM" & m.Row)
End If
End With
Next
End Sub
=============================================
Thank you!