View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Activate workbook

Tim,

It would help if you posted your code, but the general technique is to use a workbook object:

Sub Test()

Dim myBook As Workbook

Set myBook = Workbooks.Open(Application.GetOpenFilename)
myBook.Worksheets(1).Range("A1:A10").Copy _
ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count , 1).End(xlUp)(2)
myBook.Close False

End Sub

HTH,
Bernie
MS Excel MVP


"TimT" wrote in message
...
hello Experts!
Does anyone know how to activate one of two open workbooks?
My code finds opens another workbook, copies a range, activates the workbook
with the code and pastes, then goes back to the found workbook and closes it.
I need to declare the workbook somehow in case the name changes in the future.
Help?