Inserting blank columns

  • Thread starter Thread starter poppy
  • Start date Start date
P

poppy

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
 
-----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:AI").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.
(i).select, before your line which begins selection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top