Solved

# Using variables within the offset

Posted on 2007-03-21
Medium Priority
151 Views
Here is a simplified version of what I am trying to do:
Dim State as integer, r as range
Set r = range("A1")
State = 10
If r.Offset(0, State).Value = "Texas" Then ....

Assuming r.offset(0,10).value does equal "Texas", what am I doing wrong in this line:
If r.Offset(0, State).Value = "Texas" Then ....
0
Question by:tiehaze
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 47

Accepted Solution

Wayne Taylor (webtubbs) earned 2000 total points
ID: 18767344
Hi tiehaze,

It look OK to me. Given that r=A1 and State=10,  r.Offset(0, State).Value gets the value from L1. Is this correct?

Regards,

Wayne
0

Author Comment

ID: 18767386
nevermind... i got it to work, thanks for the confidence :)
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month13 days, 4 hours left to enroll