making the previous ws active in excel

Hi,

I'm copying cells on one worksheet and paste them into another ws. After being paste I once again want my macro to view the first ws. How can I do this

Maybe this example explain it better:

Activesheet.select

x = selection ' x = should be the activesheet

copy

bla bla bla

Sheets("2").Select

Paste

bla bla bla

Sheets("x").Select

Any ideas

\Jonas




Answer this question

making the previous ws active in excel

  • Dave Jenkins

    Hi

    If you mean worksheet then the below is what you need, if you mean workbook the principle is similar

    Dim ws As Worksheet
    Set ws = ActiveSheet

    ws.Activate


  • xuyca

    Perfect!

    Thank you!

    \Jonas



  • making the previous ws active in excel