Below code are some time working , & some time showing Autofill Method of Range Class Failed
Can anyone tell me how to fix it? or How to autofill any formula till last empty cell.
Private Sub rxtcp()
Sheets("rxtcp").Columns("A:A").Copy Sheets("op").Range("C1")
Sheets("op").Range("D1").Formula = "=IF(ISNUMBER(SEARCH(""RXOTG-"",RC[-1])),RC[-1],"""")"
Sheets("op").Range("D1").Autofill Destination:=Range("D1:D60000"), Type:=xlFillDefaul
End Sub
I also tried another way but not working
Range("D1").Select
Selection.AutoFill Destination:=Range("D1:60000"), Type:=xlFillDefault
i have tried also like below but some time working some time not working , showing Autofill Method of Range Class Failed
Sub rxtcp()
Sheets("rxtcp").Columns("A:A").Copy Sheets("op").Range("C1")
Dim lRow As Long
'Find the last filled row in column C
lRow = Cells(Rows.Count, 3).End(xlUp).Row
Sheets("op").Range("D1").Formula = "=IF(ISNUMBER(SEARCH(""RXOTG-"",RC[-1])),RC[-1],"""")"
Range("D1").Select
Selection.Autofill Destination:=Range("D1:D" & lRow), Type:=xlFillDefault
End Sub
Bookmarks