I am struggling to figure out a macro that will copy my formula on wherever my activecell lands on and drag that formula to the last column of my worksheet.
For example, if my activecell with the formula "1" happens to land on cell b6, I was wondering if there is a VBA code out there that would be smart enough to drag that formula horizontally to the last column (variable) in the worksheet.
This is what I have so far for my code:
Sub test()
Sheets("MTD Gross Margin").Select
Range("B:B").Find("", [B1]).Select
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
Selection.Formula = "1"
End Sub
For example, if my activecell with the formula "1" happens to land on cell b6, I was wondering if there is a VBA code out there that would be smart enough to drag that formula horizontally to the last column (variable) in the worksheet.
This is what I have so far for my code:
Sub test()
Sheets("MTD Gross Margin").Select
Range("B:B").Find("", [B1]).Select
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
Selection.Formula = "1"
End Sub