Using sheet codename problems

D

Dustin Carter

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
 
J

John Green

Dustin,

The codename should not be qualified:

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

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