Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Stuck on copying formula from 1 sheet

  Asked By: Dana    Date: Dec 08    Category: MS Office    Views: 528
  

I want to write
some VBA code I want to enter a formaula in sheet2 that will copy a
cell from sheet1. Sheet1 is active. sheet2 is not. Thanks

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Botan Suzuki     Answered On: Dec 08

Try recording what you want to do and then look at the code. That will give
you a start I'm sure.

If you don't know about recording a macro from the Tools menu then by all
means get back to us.

 
Answer #2    Answered By: Fahmida Ahmed     Answered On: Dec 08

I'm not sure if this is what you are asking for.

This will copy  a formula  from sheet1  into a cell on sheet2:
Sheets("Sheet1").Range("A3").Copy
Sheets("Sheet2").Range("A3").PasteSpecial

Another option:

Sheets("Sheet2").Range("A3").Formula =
Sheets("Sheet1").Range("A3").Formula

By using the command Sheets it doesn't matter who is active.

Remember, it's better to use variables than strings ("Sheet1", "Sheet2", "A3")
. It uses less memory and the macro runs faster.

 
Didn't find what you were looking for? Find more on Stuck on copying formula from 1 sheet Or get search suggestion and latest updates.




Tagged: