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

A

arshia22

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top