Activate Range for Workbooks Already Open

S

shorticake

Could anyone help me with code to search through the file names of workbooks
I already have open, and for each file that meets my search criteria make a
specific worksheet and range active?

Thanks
 
B

Bob Phillips

For Each wb In Application.Workbooks

If wb.name Like "*This*" then

wb.Activate
Worksheets(3).Activate
range("A3").Select
End If
Next wb

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

JLGWhiz

Dim sh As Worksheet
Dim wb As Workbook
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name Then
wb.Activate
For Each sh In Active.Workbook.Sheets
If sh ('meets criteria) Then
'Do Something
End If
Next
End If
Next
 
S

shorticake

Thanks so much Bob!

One last question, is there a way to say not like "*This*" ?
 
B

Bob Phillips

Yeah, but it's tricky

If Not wb.name Like "*This*" then

<VBG>

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Top