Allocating a value to a VBA variable from a worksheet.

G

Geoff E

I have a line in a VBA program that I am writing that reads as
follows:

For i = 26 to 35


next i

and that, of coarse, works perfectly.... but now I want to extract the
values in "E6" and "F6" on the current worksheet and place them
respectively in place of the 26 and the 35.

I know this is dead easy, but for the life of me, I just can't get my
mind around it. Any help greatly appreciated.

Geoff
 
M

Mike H

Geoff

Like this
Dim i as Long
For i = ActiveSheet.Range("E6") To ActiveSheet.Range("f6")


Next i

Mike
 
J

Jacob Skaria

For i = Sheets("test").Range("E6") To Sheets("test").Range("F6")

If it is the active sheet
For i = Range("E6") To Range("F6")


If this post helps click Yes
 
G

Geoff E

Thank you Jacob and Mike.

They both worked like a dream. Much too embarrassed to tell you what
the problem was. Too long behind this computer and tired as a result.
I think I need to get a life.

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top