VBA Code:
Dim AC As Integer
Dim myc As range
Set myc = activecell
AC = activecell.Column
'if i have identified the active cell, then i can use the LR to autofill to last row like this
VBA Code:
LR = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
range(myc, Cells(LR, AC)) = "=IFERROR(IF(RC[-3]=1,RC[-1]-RC[-14],""#""),""#"")"
'BUT
'if i am using offset ...
'i cannot see a way to identify the cell or range to be able to use the "LR" autofill
VBA Code:
myc.Offset(0, 12).Formula = "=IFERROR(IF(RC[-3]=1,RC[-1]-RC[-14],""#""),""#"")"
'unless i do this first
VBA Code:
myc.Offset(0, 12).Select
VBA Code:
Call autofill_downcol_lastrow_v2
(which operates from a selection and works fine, but a little slow)
'is there a way to combine OFFSET with "LASTROW type coding" which keeps it efficient, and not requiring multiple extra lines of code?
'which may look something like this.but not exactly this....
VBA Code:
range((myc,Offset(0, 12)) Cells(LR, AC)) = "=IFERROR(IF(RC[-3]=1,RC[-1]-RC[-14],""#""),""#"")"
'or is it not possible?
Last edited: