Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Needed to pull specific columns from worksheet Jennifer Excel Programming 8 April 30th 08 11:07 AM
create a macro to delete columns and then border remaining columns Jane777 Excel Programming 1 July 18th 07 12:08 AM
I set up a macro to hide/unhide columns. It hides more columns Lori Excel Programming 1 September 6th 06 04:08 PM
insert columns macro is putting 2 columns instead of 1 AGH Excel Worksheet Functions 2 February 27th 06 02:36 PM
VBA to show or hide columns in one worksheet conditioned on value in other worksheet punsterr Excel Programming 1 August 18th 05 09:26 AM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"