View Single Post
  #5   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 didn't like the code I posted for some reason?

--
Rick (MVP - Excel)


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

Thank you for taking the time to help me with this.

I am talking about columns. I have placed all the S&P 500 companies in a
worksheet and would like to have amongst others, price data for these
companies in rows. Luckily Excel 2007 supports more than the standard 256
columns.

How would I change the code? replace EntireRow with EntireColumn?

Best regards,

Ralph

"Rob Wills" wrote:

500 columns?!?!?

Are you getting your Rows and Columns confused?

I'm assuming you mean rows, but his can be adapted

Dim i As Integer

Application.ScreenUpdating = False 'Used to increase performance

For i = 500 To 1 Step -1
Range("A" & i).EntireRow.Insert
Range("A" & i).EntireRow.Insert
Range("A" & i).EntireRow.Insert
Next i
Application.ScreenUpdating = True


========================
"Ralph" wrote:

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