#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping


I have a worksheet that simulates dealing cards, and calculates th
number of times you could expect to get a king, queen or ace.

What I want is to graph the results as the macro runs.
I know I want a loop function, but cant get my head round it!

For information,
The range i want to graph is: A1:A40 and C1:C40 where row 1 has th
header: "queen" and "king" on A and C respectively .

I would like cell P1 to include the number of deals I want to produce
ie: the number of times it should loop.

Any ideas on how I should construct the code - my attempts have bee
unsuccessful Im afraid.

Thanks
Scott

--
scottwilson
-----------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112
View this thread: http://www.excelforum.com/showthread.php?threadid=26646

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Looping

How about:
Sub Test()

Dim lngCounter As Long
Dim lngColACounter As Long
Dim lngColCCounter As Long
Dim lngTotal As Long

lngTotal = Range("P1").Value
lngColACounter = 2
lngColCCounter = 2

For lngCounter = 1 To lngTotal
'Generate your random card.
'if the card is a queen then.
'Range("A" & lngColACounter).Value = 1
'lngColACounter = lngColACounter + 1
'End If
'if the card is a king then.
'Range("C" & lngColACounter).Value = 1
'lngColCCounter = lngColCCounter + 1
'End If
Next lngCounter

End Sub
-----Original Message-----

I have a worksheet that simulates dealing cards, and

calculates the
number of times you could expect to get a king, queen or

ace.

What I want is to graph the results as the macro runs.
I know I want a loop function, but cant get my head round

it!

For information,
The range i want to graph is: A1:A40 and C1:C40 where row

1 has the
header: "queen" and "king" on A and C respectively .

I would like cell P1 to include the number of deals I

want to produce,
ie: the number of times it should loop.

Any ideas on how I should construct the code - my

attempts have been
unsuccessful Im afraid.

Thanks
Scott.


--
scottwilsonx
----------------------------------------------------------

--------------
scottwilsonx's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=11128
View this thread:

http://www.excelforum.com/showthread...hreadid=266462

.

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
Not Looping Roger Excel Discussion (Misc queries) 0 February 26th 08 05:18 PM
Looping David T Excel Discussion (Misc queries) 2 August 30th 06 10:51 PM
Looping Louise[_4_] Excel Programming 1 September 10th 04 04:57 PM
looping to End Nabeel Moeen Excel Programming 2 February 25th 04 10:52 AM
Looping Syd[_4_] Excel Programming 1 December 11th 03 11:17 PM


All times are GMT +1. The time now is 08:26 PM.

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"