View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
nath nath is offline
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.