Quick question....I've recorded a simple macro to insert (2) columns at the end of a data set and autofill them down with the value of "1".
My question is, my data set is dynamic and my last column may not always be "S", how can I force it to the last column in the sheet...Thanks in advance...
CODE SNIP
Sub Macro1()
'
' Macro1 Macro
'
'
Range("Table2[[#Headers],[AccountTypeDescription]]").Select
Selection.End(xlToRight).Select
Range("S1").Select
ActiveCell.FormulaR1C1 = "Work"
Range("T1").Select
ActiveCell.FormulaR1C1 = "QTY"
Range("S2").Select
ActiveCell.FormulaR1C1 = "1"
Range("T2").Select
ActiveCell.FormulaR1C1 = "1"
Range("S2").Select
Selection.AutoFill Destination:=Range("Table2[Work]")
Range("Table2[Work]").Select
Range("T2").Select
Selection.AutoFill Destination:=Range("Table2[QTY]")
Range("Table2[QTY]").Select
End Sub
Bookmarks