View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Insert new colums after each one existing column

You are welcome. I don't use the web version, but I think someone once
mentioned that you need to do a refresh (not sure if that was a browser
refresh or some kind of webpage refresh) in order to see the newly arrived
responses since you opened the page. If that works, then you should do it
often when you post a message so you get to see all the responses to your
question... otherwise you might miss the perfect answer to your question
(not that I am saying my answer was perfect by any means... I'm just making
a point).

--
Rick (MVP - Excel)


"Ralph" wrote in message
...
Hi Rick,

I didn't see your post until now (using the webversion at the microsoft
website to browse the newsgroups). Thank you for your help!

Regards,

Ralph

"Rick Rothstein" wrote:

You mixed your column and row references in your description... I'll
assume
you meant columns as you subject indicates. I used Const statements to
define the parameters for the insertions (I set them to your example
request)... just change them as needed.

Sub InsertColumns()
Dim X As Long, Z As Long
Const BeginCol As Long = 1 ' Column A
Const EndCol As Long = 2 ' Column C
Const NumColToInsert As Long = 3 ' Insert 3 columns
For X = EndCol To BeginCol Step -1
For Z = 1 To NumColToInsert
Columns(X).Offset(, 1).Insert
Next
Next
End Sub

--
Rick (MVP - Excel)


"Ralph" wrote in message
...
Hi All,

I have a spreadsheet spanning 500 rows for which I would like to add a
number of columns after each exisiting column. Say the current sheet
looks
like A,B,C; I would want it to look like
A,a1,a2,a3,B,b1,b2,b3,C,c1,c2,c3,
Where the lowecase colums followed by a number are the colums that are
to
be
inserted. Since the sheet comprises of 500 columns, I suspect there is
a
faster way than doing this manually, I just don't know how to. Could
you
help
me out?

Best regards,

Ralph