I am creating a VB macro in excel which needs to be run once a month. This macro formats the excel file. Part of the formatting is to add a column(Col A) and repeat a value in that column for all rows in the file. The number of rows will vary each month. I need the macro to repeat the value in Column A where there is a value in Column C. I was trying to use the "The Do While Not IsEmpty, but keep getting syntax errors. Any ideas?
'Insert row to add Transit#
Columns("A:A"
.Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("A:A"
.Select
Selection.NumberFormat = "000000000"
Range("A1"
.Select
ActiveCell.FormulaR1C1 = "55000262"
Set CurrentCell = ActiveSheet.Range("A1"
Columns("A:A"
.Select
Do While Not IsEmpty(ActiveSheet.Range("C:C"
)
CurrentCell.Select
Selection.Copy
Set NextCell = CurrentCell.Offset(1, 0)
Set CurrentCell = NextCell
NextCell.Select
Loop
'Insert row to add Transit#
Columns("A:A"
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("A:A"
Selection.NumberFormat = "000000000"
Range("A1"
ActiveCell.FormulaR1C1 = "55000262"
Set CurrentCell = ActiveSheet.Range("A1"
Columns("A:A"
Do While Not IsEmpty(ActiveSheet.Range("C:C"
CurrentCell.Select
Selection.Copy
Set NextCell = CurrentCell.Offset(1, 0)
Set CurrentCell = NextCell
NextCell.Select
Loop