Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using variables within the offset

Posted on 2007-03-21
2
Medium Priority
?
152 Views
Last Modified: 2010-04-30
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
Comment
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
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
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

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question