Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting blank columns

Hi again

I am trying to insert a column into an excel sheet. Using VBA it read
like this:

'shift cells to right
Range("E:E,H:H,K:K,N:N,Q:Q,T:T,W:W,Z:Z,AC:AC,AF:AF ,AI:AI").Select
Selection.Insert Shift:=xlToRight

I am trying to do this in VB this way. I am not sure of the syntax

For i = 2 To 31 Step 4
Selection.Insert Shift:=xlToRight
Next

Any one with the equivalent in VB would be appreciated

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Inserting blank columns


-----Original Message-----
Hi again

I am trying to insert a column into an excel sheet. Using

VBA it reads
like this:

'shift cells to right
Range

("E:E,H:H,K:K,N:N,Q:Q,T:T,W:W,Z:Z,AC:AC,AF:AF,AI:A I").Selec
t
Selection.Insert Shift:=xlToRight

I am trying to do this in VB this way. I am not sure of

the syntax

For i = 2 To 31 Step 4
Selection.Insert Shift:=xlToRight
Next

Any one with the equivalent in VB would be appreciated.


---
Message posted from http://www.ExcelForum.com/

almost there, you just need to add activesheet.columns

(i).select, before your line which begins selection.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting blank columns

Hi Nath

Thanx for your help my code is working fine.


Kind Regard

--
Message posted from http://www.ExcelForum.com

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
Inserting blank rows plus using Sum Bill95051 New Users to Excel 3 April 8th 09 07:38 PM
Totalling columns & inserting blank row afterwards Alfadeke Excel Discussion (Misc queries) 0 January 29th 09 08:41 PM
inserting a blank row mrselkoil Excel Discussion (Misc queries) 1 January 24th 07 09:18 PM
Can parital cells be underlined w/o inserting blank columns? FinancialStmtProb2006 Excel Discussion (Misc queries) 2 May 28th 06 03:44 PM
Formula for inserting blank row Connie Martin Excel Worksheet Functions 6 November 18th 05 04:12 PM


All times are GMT +1. The time now is 08:37 AM.

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"