LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Macro to add / delete column

Hello,

I dont think this is difficult but i cannot get it work properly. I have the
following macro:

Sub PEc_General()
Sheets("sheet1").Columns("D:E").EntireColumn.Hidde n = True = Not _
Sheets("sheet1").Columns("D:E").EntireColumn.Hidde n = True
Sheets("sheet2").Columns("C:C").EntireColumn.Hidde n = True = Not _
Sheets("sheet2").Columns("C:C").EntireColumn.Hidde n = True
End Sub

This macro toggles between hiding and showing some columns. Macro works
perfect but i want to extend it a little bit. If i activate the macro it
hides the columns (D,E and C), if i activate it again it shows the columns
again. What i would like is the following. If i activate the macro it hides
the columns and i would like to create an extra column
(Columns("I:I").EntireColumn.Insert Shift:=xlToRight). If i activate the
macro again it shows the columns again and i would like to delete the created
column again (column I)

Hopefully i explained it correct... Thanks
 
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
Converting a “Delete Column” Macro to a “Delete Row” Macro cardan Excel Programming 4 May 14th 10 02:09 AM
Macro to delete Column Kim Excel Discussion (Misc queries) 1 September 21st 09 12:09 PM
macro to delete the last value in each column z.entropic Excel Worksheet Functions 11 July 21st 07 01:10 PM
Macro to delete row if value in column J =0 annep[_5_] Excel Programming 4 January 1st 06 11:26 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM


All times are GMT +1. The time now is 03:00 PM.

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

About Us

"It's about Microsoft Excel"