My VBA Macro code is supposed to insert Column C, add the heading and then type a formula into cell C2 =text(B2," mm/dd/yyyy ") I then want to copy and paste that formula to the bottom of the data. The problem is that the range changes with each spreadsheet. I do I code it to look at column B and go to the end of the data and copy the formula up to Row 2?
Just learning to do Macros and need to modify the script.
Here is my code:
Sub TEST1()
'
' TEST1 Macro
'
'
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("C1").Select
ActiveCell.FormulaR1C1 = "Revised Billed Date"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],"" mm/dd/yyyy "")"
Range("C2").Select
Selection.Copy
Range("B2").Select
Selection.End(xlDown).Select
Range("C8").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Range("C7").Select
Selection.End(xlUp).Select
Range("C2").Select
End Sub
