ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using sheet codename problems (https://www.excelbanter.com/excel-programming/292094-using-sheet-codename-problems.html)

Dustin Carter

Using sheet codename problems
 
I'm having problems with the way I access sheets of the
ActiveWorkbook from an addin. Basically, I need to
rewrite the following line of code (simplified for this
example) to use the sheet's codename (SamplePrep) instead
of the sheet's position in the Sheets collection (sheets
(1)):

vResult = ActiveWorkbook.Sheets(1).Range("A:A").Find
(iSearchValue).Offset(0,2).Value

to something like this:

vResult = ActiveWorkbook.SamplePrep.Range("A:A").Find
(iSearchValue).Offset(0,2).Value

Any ideas or suggestions would be *greatly* appreciated.

Thanks in advance,
Dustin Carter

John Green[_3_]

Using sheet codename problems
 
Dustin,

The codename should not be qualified:

vResult = SamplePrep.Range("A:A").Find

--

John Green - Excel MVP
Sydney
Australia


"Dustin Carter" wrote in message ...
I'm having problems with the way I access sheets of the
ActiveWorkbook from an addin. Basically, I need to
rewrite the following line of code (simplified for this
example) to use the sheet's codename (SamplePrep) instead
of the sheet's position in the Sheets collection (sheets
(1)):

vResult = ActiveWorkbook.Sheets(1).Range("A:A").Find
(iSearchValue).Offset(0,2).Value

to something like this:

vResult = ActiveWorkbook.SamplePrep.Range("A:A").Find
(iSearchValue).Offset(0,2).Value

Any ideas or suggestions would be *greatly* appreciated.

Thanks in advance,
Dustin Carter





All times are GMT +1. The time now is 03:08 AM.

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