ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Columns (https://www.excelbanter.com/excel-programming/308699-insert-columns.html)

Scottmk[_29_]

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


Bob Phillips[_6_]

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/




Scottmk[_30_]

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/


Bob Phillips[_6_]

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/




Scottmk[_31_]

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

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



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com