macros vba need to apply formula to column till it has value in the last row
问题 I need to apply "IF "formula in whole C column till has last value in the sheet using VBA . but i am getting error 438 if i use the following code . Plz help me Sub test11() With Sheets("Sheet") .Range("c1:c" & .Cells(.Rows.Count, "A").End(xlUp).Row).Formula = "=IF(B1="",TRIM(A1),TRIM(B1))" End With End Sub 回答1: So your sheet name is Sheet or Sheet1 ? And OP mentioned Sheet name is Sheet2 . That removes one error. Secondly, you need to set D column as .Cells(.Rows.Count,"D").End(xlUp).Row)