I have a bit of code that auto fills formulas down to the last row. I want this code to work on two sheets (with different ranges) and to have a button on a separate control sheet.
The problem is, when i run the macro from the control sheet, it affects the control sheet, even though i specified the target sheets in the code. Is there a way around this?
Sub FormulaFill()
Dim DataLR As Long
DataLR = Worksheets("Data").UsedRange.Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Range("I2:M2").AutoFill Destination:=Range("I2:M" & DataLR)
Dim DataKeywordLR As Long
DataKeywordLR = Worksheets("data keyword").UsedRange.Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Range("I2").AutoFill Destination:=Range("I2:" & DataKeywordLR)
Worksheets("Data").Range("I2:M2"). – Seth Nov 25 '16 at 11:10that did the trick. Thanks, Seth – Corrado_ Nov 25 '16 at 13:14