Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default setting a variable to the offset of another object declared variab

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default setting a variable to the offset of another object declared variab

1. check your declartion. Declare as Range

2. popfromzone. or PopFrom.


--
If this post helps click Yes
---------------
Jacob Skaria


"ironhydroxide" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default setting a variable to the offset of another object declared variab

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


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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default setting a variable to the offset of another object declared va

exactly what was needed. Thanks


"Bernie Deitrick" wrote:

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


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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference a variable declared in VBA James Excel Worksheet Functions 3 September 12th 08 10:31 PM
Type change in a declared Variable? Martin Fishlock Excel Programming 0 December 13th 06 01:30 AM
Type change in a declared Variable? Gary''s Student Excel Programming 0 December 13th 06 01:23 AM
Using Offset on Variable Dinensioneds Object ExcelMonkey Excel Programming 3 August 19th 05 05:44 PM
setting object variable [email protected] Excel Programming 2 May 13th 05 07:28 PM


All times are GMT +1. The time now is 01:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"