Sub insertColumns()
If Cells(1, 1).End(xlToRight).Column = Columns.Count Then MsgBox "No populated columns"
For x = 1 To 3
Columns(Cells(1, 1).End(xlToRight).Column).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromRightOrBelow
Next x
End Sub
This is great! Just one tweek I'm not sure how to do. I have data in columns (3 columns for each month). After the current month there is one blank column. I'd like to essentially insert 3 rows to the right of the current month (but before the blank column) with the most recent month's formatting. What should I change in the syntax to accomplish this? I really appreciate your help!!
Sub insertColumns()
If Cells(1, 1).End(xlToRight).Column = Columns.Count Then MsgBox "No populated columns"
For x = 1 To 3
Columns(Cells(1, 1).End(xlToRight).Column + 1).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Next x
End Sub
Sub insertColumns()
If Cells(1, 1).End(xlToRight).Column = Columns.Count Then MsgBox "No populated columns"
For x = 1 To 3
Columns(Cells(1, 1).End(xlToRight).Column + 1).Insert Shift:=xlToLeft, CopyOrigin:=xlFormatFromLeftOrAbove
Next x
End Sub
Sub insertColumns()
If Cells(1, Columns.Count).End(xlToLeft).Column = Columns.Count Then MsgBox "No populated columns"
For x = 1 To 3
Columns(Cells(1, Columns.Count).End(xlToLeft).Column + 1).Insert Shift:=xlToLeft, CopyOrigin:=xlFormatFromLeftOrAbove
Next x
End Sub
You're absolutely amazing!!! I appologize, I didn't articulate my problem very well to begin with. This is great! Thank you so much!