Solved

Using variables within the offset

Posted on 2007-03-21
2
146 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
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now