Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default evaluate and variables and loop...

I haven't used "Evaluate" very much. I saw an article on it and
decided to try so I didn't have to use formulas in my spreadsheet to
get things done. But now I'm running into issues with it.
Hopefully someone can help me.

Can I use a variable in an evaluation?
my code:

Dim people As Integer
Dim i As Integer
Dim x As Boolean
Set rng = [lst]
Set rng1 = rng.Offset(0, 1)
Set rng2 = rng1.Offset(0, 1)
rng2.Formula = "=rand()"
people = rng2.Rows.Count
i = 1
For i = 1 To people
Cells(i, 4).Value = "=IF(A" & i & "=B" & i & ",True,False)"
Next i

' this is my problem line:
x = [IF((COUNTIF(D:D,"False"))={this is where I want my variable
"people" to go},False,True)]

Do Until x = True
'msgbox x
rng1.Resize(, 3).Sort Key1:=rng2
Loop

My second problem is that even if I just type the value I want (in this
case 17) into the evaluation formula, my loop lasts forever. Even if
the formula for x = True...
My syntax must be wrong. I've been looking at some heavy code for
about 10 days straight and am probably missing something simple again.

Thanks,
Rob

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default evaluate and variables and loop...

OK, using the message box, I found that x is always False and the loop
runs forever...
SO, my problem is truly the evaluation statement.
x = [IF((COUNTIF(D:D,"False"))={this is where I want my variable
"people" to go},False,True)]



OKROB wrote:
I haven't used "Evaluate" very much. I saw an article on it and
decided to try so I didn't have to use formulas in my spreadsheet to
get things done. But now I'm running into issues with it.
Hopefully someone can help me.

Can I use a variable in an evaluation?
my code:

Dim people As Integer
Dim i As Integer
Dim x As Boolean
Set rng = [lst]
Set rng1 = rng.Offset(0, 1)
Set rng2 = rng1.Offset(0, 1)
rng2.Formula = "=rand()"
people = rng2.Rows.Count
i = 1
For i = 1 To people
Cells(i, 4).Value = "=IF(A" & i & "=B" & i & ",True,False)"
Next i

' this is my problem line:
x = [IF((COUNTIF(D:D,"False"))={this is where I want my variable
"people" to go},False,True)]

Do Until x = True
'msgbox x
rng1.Resize(, 3).Sort Key1:=rng2
Loop

My second problem is that even if I just type the value I want (in this
case 17) into the evaluation formula, my loop lasts forever. Even if
the formula for x = True...
My syntax must be wrong. I've been looking at some heavy code for
about 10 days straight and am probably missing something simple again.

Thanks,
Rob


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
Setting Multiple Variables with a loop jlclyde Excel Discussion (Misc queries) 6 November 11th 09 09:40 PM
Non Static Variables in a For...Next Loop Jess[_2_] Excel Programming 16 December 29th 06 10:00 PM
Is it possible to create variables in a loop.. shishi Excel Programming 2 February 3rd 06 07:21 PM
Write variables from a loop, once only Novaloc Excel Programming 1 October 11th 05 04:10 AM
Excel VBA - changing variables during a loop ellis_x[_3_] Excel Programming 3 July 5th 04 08:44 AM


All times are GMT +1. The time now is 12:31 AM.

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

About Us

"It's about Microsoft Excel"