Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Insert new colums after each one existing column

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Insert new colums after each one existing column

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Insert new colums after each one existing column

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Insert new colums after each one existing column

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Insert new colums after each one existing column

i don't think they didn't like it. i think they don't see it. i've noticed so
many people pay attention to one thread and don't notice somebody else
responded.

--


Gary

"Rick Rothstein" wrote in message
...
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




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Insert new colums after each one existing column

I liked it ;-)

(beat mine hands down)

"Rick Rothstein" wrote:

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



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Insert new colums after each one existing column

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



  #9   Report Post  
Posted to microsoft.public.excel.programming
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




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
How can I insert a colon into a column of existing numbers jcmonzon Excel Discussion (Misc queries) 6 April 2nd 23 07:40 PM
match first and last name and insert column into existing sheet Sarah Excel Worksheet Functions 1 November 16th 09 04:14 PM
How do I insert sub-columns within an existing column? Sunranae Excel Discussion (Misc queries) 1 April 15th 09 12:31 PM
Insert 5 rows between existing values in a single column 1 camsd Excel Worksheet Functions 7 October 16th 08 08:56 PM
How do I insert hypens in existing column representing social sec. hard head Excel Discussion (Misc queries) 1 January 5th 05 06:47 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"