ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to add a new column with the previous column formula? (https://www.excelbanter.com/excel-programming/324502-how-add-new-column-previous-column-formula.html)

arshia22

How to add a new column with the previous column formula?
 
Hi everybody;
How can I write a macro to add a new column to the right of the last
column of my sheet , in a way that it also copy all the formulas from
the previous column?
regards,
Sean


Bob Phillips[_6_]

How to add a new column with the previous column formula?
 
Sean,

Here is some code

Dim cLastCol As Long

cLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Cells(1, cLastCol).EntireColumn.Copy Destination:=Cells(1, cLastCol + 1)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"arshia22" wrote in message
ups.com...
Hi everybody;
How can I write a macro to add a new column to the right of the last
column of my sheet , in a way that it also copy all the formulas from
the previous column?
regards,
Sean





All times are GMT +1. The time now is 05:51 AM.

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