setting a variable to the offset of another object declared variab

I

ironhydroxide

I am having problems with offset. i cant seem to get the offset function to
set a variable to the offset of another variable (a cell) here are a couple
code snippits that i have tried already.

Set PopFromZone = Selection.Offset(0, 2)
If PopFromZone = "Zone AV" Then ' type Error 13 Type Mismatch

If PopFrom.Offset(0, 2) = "Zone AV" Then 'Run Time error 434 Object
Required

Thanks for replies

Ironhydroxide
 
B

Bernie Deitrick

Rusty,

For the first one, you need to limit yourself to one cell:

If PopFromZone.Cells(1) = "Zone AV" Then

The second one.... well, you are not setting PopFrom as a range anywhere, and you need to limit to
one cell.

HTH,
Bernie
MS Excel MVP
 
I

ironhydroxide

exactly what was needed. Thanks


Bernie Deitrick said:
Rusty,

For the first one, you need to limit yourself to one cell:

If PopFromZone.Cells(1) = "Zone AV" Then

The second one.... well, you are not setting PopFrom as a range anywhere, and you need to limit to
one cell.

HTH,
Bernie
MS Excel MVP
 

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