Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Set Variable equal to........

For i = 3 to 42
For j = 1 To 20

and then refence

Cells(j,"B")

and

Cells(i,"A")

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Aaron" wrote in message
...
Great! That makes sense and it works. What about the range of values?

Thank you for your help!

"Gary''s Student" wrote:

Hi Aaron:

One step at a time:

For i=1 to 10

can be replaced by variables that can be set by cell values

istart=Range("A3").Value
iend=istart+39
For i=istart to iend

So we are using the value in Cell A3 to define the start of the loop
--
Gary's Student


"Aaron" wrote:

I have a macro that is dependent upon a set of variables. Instead of
hard
coding the possibilities for the variables I want it to use values for
the 2
variables from cells in the sheet how would that work? And from a range
of
values in the spreadsheet?

I don't know if this is right or not but something like:
For i = "A3" To ("A3" + 39)
For j = "B1" To "B20" or "B1:B20" (whatever is correct code)
Actually
now that I think about it, it would need to be the "B1:B20" version if
possible because it is a set of codes not a liniear set of numbers.

Instead of:
For i = 1 To 10
For j = 1 To 10



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
VBA check to see if variable value is odd but not equal to 1 Dave L[_2_] Excel Discussion (Misc queries) 4 November 21st 07 01:54 AM
Setting worksheet name equal to variable value newguy Excel Programming 2 December 13th 06 11:09 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Set variable equal to a cell value & more Al[_7_] Excel Programming 1 August 25th 03 07:59 PM
variable not equal to expression steve Excel Programming 2 August 11th 03 07:05 PM


All times are GMT +1. The time now is 09:29 PM.

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"