[RESOLVED] If cell not empty...AUTOFILL VBA (FormulaR1C1)
Not sure how to explain this, but I'll give it a go.
I'm importing a csv file. After that I'm adding additional columns and values, all using VBA.
I have a small issue with adding a R1C1 formula and fill the formula to the bottom.
Example:
A1 : xxxxx
A2: yyyyy
A3:
A4: zzzzz
A5: sssss
A6: eeeee
A7: jjjjj
In Column B I need to add "ready" if the cell next to it is not empty.
Code:
With Range("B1")
.FormulaR1C1 = "=IF(RC[-1]<>"""",""ready"","""")"
.AutoFill Destination:=Range(.Offset(0, -1), .Offset(0, -1).End(xlDown)).Offset(0, 1)
End With
The autofill adds one after the first empty cell and then stops. How do i change it so it will use the usedRange?
Thanks in advance.
Re: If cell not empty...AUTOFILL VBA (FormulaR1C1)
you can try like
.AutoFill .Resize(.Offset(Rows.Count - .Row, -1).End(xlUp).Row)
Re: If cell not empty...AUTOFILL VBA (FormulaR1C1)
Thanks, that did it.
When the column is comletely empty it returns an error, but I "solved" it by using "on error resume next". Probably not the proper way to solve it, but I'm saved for the moment.
Re: [RESOLVED] If cell not empty...AUTOFILL VBA (FormulaR1C1)
Quote:
Probably not the proper way to solve it
i would have to agree