View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Activate a Workbook

There is no need to activate the sheets or the workbook. Just use wb instead
of the workbook name


For Each wb In Workbooks
'Test to see if wb's name is like "*C&A PF*.xlsm"
If wb.Name Like "*C&A PF*.xlsm" Then
with wb
.sheets("Sheet1").Range("A1") = "ABC"
end wb
End If
Next


"Bishop" wrote:

I have this code:

For Each wb In Workbooks
'Test to see if wb's name is like "*C&A PF*.xlsm"
If wb.Name Like "*C&A PF*.xlsm" Then
???.Activate
End If
Next

How do I make THAT workbook the active workbook?