Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Allocating a value to a VBA variable from a worksheet.

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Allocating a value to a VBA variable from a worksheet.

Geoff

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


Next i

Mike

"Geoff E" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Allocating a value to a VBA variable from a worksheet.

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
---------------
Jacob Skaria


"Geoff E" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Allocating a value to a VBA variable from a worksheet.

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


On Sep 6, 11:14*pm, Jacob Skaria
wrote:
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
---------------
Jacob Skaria



"Geoff E" wrote:
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- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
allocating numbers to cells Ujpest Excel Worksheet Functions 0 March 3rd 10 06:46 PM
Allocating percentages Fred Smith[_4_] Excel Discussion (Misc queries) 11 January 18th 10 09:51 PM
Allocating remainders ramtroop Excel Worksheet Functions 2 October 16th 08 10:35 PM
Allocating a value from a cell babygoode Excel Worksheet Functions 2 August 9th 05 10:24 PM
Allocating a Value Raymond Gallegos Excel Worksheet Functions 1 January 7th 05 01:10 AM


All times are GMT +1. The time now is 07:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"