View Single Post
  #5   Report Post  
Matilda
 
Posts: n/a
Default

Dave, I want to have your grandchildren !!
XXXX

"Dave Peterson" wrote:

system label = Codename
(the name you see in the VBE project explorer?)

dim wks as worksheet
with workbooks("Filename.xls")
.activate
for each wks in .worksheets
if lcase(wks.codename) = "sheet1" then
wks.select
exit for
end if
next wks
end with



Matilda wrote:

Thanks, Dave. Sorry for the lack of information. Yes, 2nd workbook open,
tried to activate it and select it thus:
Workbooks("filename.xls").Activate
Sheets("Sheet1").Select
and got the exact same error.
I was trying to refer to the system label for the worksheet rather than the
user defined string.
I want to take a string from workbook 1 and search for its match in workbook 2

"Dave Peterson" wrote:

Is there a workbook named Filename.xls open?
If yes, does that workbook have a worksheet named Sheet1?

And if yes to both, is that workbook the active workbook--you can only select a
worksheet on the active workbook.

Workbooks("filename.xls").Select
Workbooks("filename.xls").Worksheets("Sheet1").Sel ect

Or maybe:

application.goto Workbooks("filename.xls").Worksheets("Sheet1").Ran ge("a1"), _
scroll:=true

would be sufficient.

Matilda wrote:

Help please! Why am I getting a Runtime error 9 subscript out of range error
on this statement?
Workbooks("filename.xls").Worksheets("Sheet1").Sel ect

Many TIAs

--

Dave Peterson


--

Dave Peterson