ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activate Range for Workbooks Already Open (https://www.excelbanter.com/excel-programming/402735-activate-range-workbooks-already-open.html)

shorticake

Activate Range for Workbooks Already Open
 
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

Bob Phillips

Activate Range for Workbooks Already Open
 

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)



"shorticake" wrote in message
...
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




JLGWhiz

Activate Range for Workbooks Already Open
 
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

"shorticake" wrote:

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


shorticake

Activate Range for Workbooks Already Open
 
Thanks so much Bob!

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


"Bob Phillips" wrote:


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)



"shorticake" wrote in message
...
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





Bob Phillips

Activate Range for Workbooks Already Open
 
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)



"shorticake" wrote in message
...
Thanks so much Bob!

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


"Bob Phillips" wrote:


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)



"shorticake" wrote in message
...
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








All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com