How can I refer to the ActiveWindow

  • Thread starter Thread starter CarolineHedges
  • Start date Start date
C

CarolineHedges

I my macro I improt data by opening a spreadsheet copying the data ove
and closing it, and therefore flick between workbooks.

This is creating my problems and flicks to the wrong workbook
occasionally.

So I need to tell it to flick back the workbook the marco is in, bu
this workbook changes its name, so I can not say:

Windows(".......").Activate

Is there a way I can at the beginning give the workbook a nam
reference early on in the macro, eg something like:

MacroWorkbook = ActiveWindow

? And then each time I want to flick to this workbook I can refer to i
as:

Windows(MacroWookbook).Activate?

Thank
 
ThisWorkbook.Activate
will always activate the workbook in which the macro is located. Is
there a problem with using this?
James
 
Try

ThisWorkbook.Activate

Regards,
Stefi


„CarolineHedges†ezt írta:
 
I knew there must be a really simple way, but I just didn't know what i
was.

Thank yo
 

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

Back
Top