ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range with a variable (https://www.excelbanter.com/excel-programming/393137-range-variable.html)

Animal via OfficeKB.com

Range with a variable
 
Hello there,

Can't understand why I can't find the solution to thins simple problem
anywhere.

Set d = Range("Year:" & c.Offset(-1, 0)).Find(Range("ReportYear"),
LookIn:=xlValues)

I don't know how to wright the syntax for a range which uses a variable. Must
be a common problem or? It workes when I do like this:
b = 1
Set d = Range("A" & b)
But when i want a range from "a" to "b" and use the symbol of ":" it doesn't
work.

Can someone help me please, I get an error all the time.
/Animal

--
Message posted via http://www.officekb.com


Wigi

Range with a variable
 
Something like this?

Set d = Range("A" & b, "C" & f)

and b and f are numbers. CHange to suit.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Animal via OfficeKB.com" wrote:

Hello there,

Can't understand why I can't find the solution to thins simple problem
anywhere.

Set d = Range("Year:" & c.Offset(-1, 0)).Find(Range("ReportYear"),
LookIn:=xlValues)

I don't know how to wright the syntax for a range which uses a variable. Must
be a common problem or? It workes when I do like this:
b = 1
Set d = Range("A" & b)
But when i want a range from "a" to "b" and use the symbol of ":" it doesn't
work.

Can someone help me please, I get an error all the time.
/Animal

--
Message posted via http://www.officekb.com



Animal via OfficeKB.com

Range with a variable
 
Thank you very much it worked of course.

I had already tried it, but nothing happend and I found another problem for
that in a merged cell.

Take care

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200707/1



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com