Abhishekghorpade
Board Regular
- Joined
- Oct 3, 2018
- Messages
- 78
Hi,
I am getting "Application-defined or object-defined error" error msg for below codes.. Not able to figure out where i am going wrong. Please help
Sub conditionE()
Dim lastrow As Long
lastrow = WorksheetFunction.CountA(Worksheets("2018_T933").Range("A:A"))
With Worksheets("2018_T933").Range("A6")
.Formula = "=IF(AND(YEAR(I6)<=2016,H6<=0.5,D6>=0.5),""D"",""A"")"
.AutoFill Destination:=Worksheets("2018_T933").Range("A6:A" & lastrow)
End With
End Sub
------------------------------------------------------------------------------------------
Sub copyfromsheet1()
Dim lastrow As Long
lastrow = WorksheetFunction.CountA(Worksheets("Sheet2").Range("A:A"))
With Worksheets("Sheet2").Range("H2")
.Formula = "=IF(A2=""A"",""A"","" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("H2:H" & lastrow)
End With
With Worksheets("Sheet2").Range("I2")
.Formula = "=IF(A2=""A"",""A"","" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("I2:I" & lastrow)
End With
With Worksheets("Sheet2").Range("K2")
.Formula = "=IF(A2=""A"",2018_T933!H6,"" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("K2:K" & lastrow)
End With
End Sub
I am getting "Application-defined or object-defined error" error msg for below codes.. Not able to figure out where i am going wrong. Please help
Sub conditionE()
Dim lastrow As Long
lastrow = WorksheetFunction.CountA(Worksheets("2018_T933").Range("A:A"))
With Worksheets("2018_T933").Range("A6")
.Formula = "=IF(AND(YEAR(I6)<=2016,H6<=0.5,D6>=0.5),""D"",""A"")"
.AutoFill Destination:=Worksheets("2018_T933").Range("A6:A" & lastrow)
End With
End Sub
------------------------------------------------------------------------------------------
Sub copyfromsheet1()
Dim lastrow As Long
lastrow = WorksheetFunction.CountA(Worksheets("Sheet2").Range("A:A"))
With Worksheets("Sheet2").Range("H2")
.Formula = "=IF(A2=""A"",""A"","" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("H2:H" & lastrow)
End With
With Worksheets("Sheet2").Range("I2")
.Formula = "=IF(A2=""A"",""A"","" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("I2:I" & lastrow)
End With
With Worksheets("Sheet2").Range("K2")
.Formula = "=IF(A2=""A"",2018_T933!H6,"" "")"
.AutoFill Destination:=Worksheets("Sheet2").Range("K2:K" & lastrow)
End With
End Sub