Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert Columns

Hi,
I have 26 columns of data from (B:AA). Their headers are in row 1.
I am trying to get a code that will insert 1 column next to each colum
of data and copy the header over into the blank column. Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Insert Columns

Dim i As Long

For i = 27 To 1 Step -1
Columns(i + 1).EntireColumn.Insert
Cells(1, i + 1).Value = Cells(1, i).Value
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Scottmk " wrote in message
...
Hi,
I have 26 columns of data from (B:AA). Their headers are in row 1.
I am trying to get a code that will insert 1 column next to each column
of data and copy the header over into the blank column. Thanks


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert Columns

Thanks Bob!! one thing, I don't want a column inserted after A. I want
it to start at B. Thanks


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Insert Columns

Sorry Scott,

just change it to

Dim i As Long

For i = 27 To 2 Step -1
Columns(i + 1).EntireColumn.Insert
Cells(1, i + 1).Value = Cells(1, i).Value
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Scottmk " wrote in message
...
Thanks Bob!! one thing, I don't want a column inserted after A. I want
it to start at B. Thanks


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert Columns

Thanks for all of your help Bob...I really appreciate it.
Scot

--
Message posted from http://www.ExcelForum.com

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 columns of dates in between exsisting columns of PJS Excel Discussion (Misc queries) 1 December 22nd 08 03:22 PM
can no longer insert new columns & unhide hidden columns em2 Excel Worksheet Functions 1 July 19th 07 03:18 AM
unable to insert columns in excel, insert- columns (disabled) iam_leearner Excel Discussion (Misc queries) 1 August 13th 06 02:26 PM
insert columns macro is putting 2 columns instead of 1 AGH Excel Worksheet Functions 2 February 27th 06 02:36 PM
Using VBA to insert Columns Michael Excel Worksheet Functions 8 July 25th 05 11:52 PM


All times are GMT +1. The time now is 04:00 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"