![]() |
Macro to add columns into worksheet
I wrote a macro to add columns into a worksheet called "DrListWorkCopy"
For some reason the macro incerted 3 extra columns at the end of column"Z". Anyone see where I went wrong? These are my codes Public Sub IncertColDrListWorkCopy() Dim WorkCopy As Worksheet Set WorkCopy = Sheets("DrListWorkCopy") With WorkCopy Columns("L").Select Selection.Insert 'Shift:=xlToLeft Columns("O").Select Selection.Insert 'Shift:=xlToLeft Columns("Q").Select Selection.Insert 'Shift:=xlToLeft Columns("W").Select Selection.Insert 'Shift:=xlToLeft Columns("Z").Select Selection.Insert 'Shift:=xlToLeft End With End Sub |
Macro to add columns into worksheet
Nothing pops out right away.
But when funny things happen on inserting/deleting, I look for merged cells. They are a pain. I do my best to not use them. Blubber wrote: I wrote a macro to add columns into a worksheet called "DrListWorkCopy" For some reason the macro incerted 3 extra columns at the end of column"Z". Anyone see where I went wrong? These are my codes Public Sub IncertColDrListWorkCopy() Dim WorkCopy As Worksheet Set WorkCopy = Sheets("DrListWorkCopy") With WorkCopy Columns("L").Select Selection.Insert 'Shift:=xlToLeft Columns("O").Select Selection.Insert 'Shift:=xlToLeft Columns("Q").Select Selection.Insert 'Shift:=xlToLeft Columns("W").Select Selection.Insert 'Shift:=xlToLeft Columns("Z").Select Selection.Insert 'Shift:=xlToLeft End With End Sub -- Dave Peterson |
Macro to add columns into worksheet
Wow Dave
Really shows how experienced you are. Yes, its due to merged cells adjacent to column Z. Thanks!!! "Dave Peterson" wrote: Nothing pops out right away. But when funny things happen on inserting/deleting, I look for merged cells. They are a pain. I do my best to not use them. Blubber wrote: I wrote a macro to add columns into a worksheet called "DrListWorkCopy" For some reason the macro incerted 3 extra columns at the end of column"Z". Anyone see where I went wrong? These are my codes Public Sub IncertColDrListWorkCopy() Dim WorkCopy As Worksheet Set WorkCopy = Sheets("DrListWorkCopy") With WorkCopy Columns("L").Select Selection.Insert 'Shift:=xlToLeft Columns("O").Select Selection.Insert 'Shift:=xlToLeft Columns("Q").Select Selection.Insert 'Shift:=xlToLeft Columns("W").Select Selection.Insert 'Shift:=xlToLeft Columns("Z").Select Selection.Insert 'Shift:=xlToLeft End With End Sub -- Dave Peterson |
Macro to add columns into worksheet
Those merged cells can be more trouble than they're worth!
Blubber wrote: Wow Dave Really shows how experienced you are. Yes, its due to merged cells adjacent to column Z. Thanks!!! "Dave Peterson" wrote: Nothing pops out right away. But when funny things happen on inserting/deleting, I look for merged cells. They are a pain. I do my best to not use them. Blubber wrote: I wrote a macro to add columns into a worksheet called "DrListWorkCopy" For some reason the macro incerted 3 extra columns at the end of column"Z". Anyone see where I went wrong? These are my codes Public Sub IncertColDrListWorkCopy() Dim WorkCopy As Worksheet Set WorkCopy = Sheets("DrListWorkCopy") With WorkCopy Columns("L").Select Selection.Insert 'Shift:=xlToLeft Columns("O").Select Selection.Insert 'Shift:=xlToLeft Columns("Q").Select Selection.Insert 'Shift:=xlToLeft Columns("W").Select Selection.Insert 'Shift:=xlToLeft Columns("Z").Select Selection.Insert 'Shift:=xlToLeft End With End Sub -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 06:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com