Allocating a value to a VBA variable from a worksheet.

  • Thread starter Thread starter Geoff E
  • Start date Start date
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
 
Geoff

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


Next i

Mike
 
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
 
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
 
Back
Top