LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Changing a "Counter" Value from a Sub

Hi,

I want to know if it is possible to change a "counter" amount, (or call address
number?) from a sub which the main sub calls. For example, suppose I have a
setup something like this:

Sub MySub()
Count = 1
Coot = 2
For i = 1 to 50
Count = Count + 1
Coot = Coot + 1
If Sheet1.Cells(Count,1) < Then Fred ()
....
Next i
End Sub

Fred()
(some code)
End Sub

The data I am looking at is such that if something happens in Fred(), the
counter value for MySub() must be altered. Usually it has to be increased.
For example, if the next Count number in MySub() shuuld be, say, 8 (according
to the For...Next system), a value I discover in Fred may make it necessary
for the counter in MySub() to be, say 9. This allows the program to look at a
cell in a different order that it would automatically do following the
instructions in MySub(). i.e. Cell (9,1) instead of Cell (8,1) Right now I do
not seem to be able to have that happen. I have looked at the counter value in
Fred() and I can make it change to any number I want by adding X to it (Count
= Count + X). However, when I look at "Couint' in MySub() it does not
change to the value I give it in Fred(). (At least I do not think it does and
I do not get the end result I need.) . I have set the variable "Count" to
Public but even if I change it it Fred(), it MySub() does not seem change
"Count." The program I am writing works OK except for the counter problem.
Any suggestions as to how I can do what I need to do?

Thanks
 
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
How do I stop "global" hyperlinks changing to "local" links? Em Excel Worksheet Functions 2 August 26th 08 01:18 PM
How do I set up a "roll over" counter in excel 2003? mcorson Excel Worksheet Functions 1 March 6th 07 09:10 PM
multiple file uploading - runtime error'13': type mismatch "While Counter <= UBound(FName)" Sinner Excel Discussion (Misc queries) 3 March 1st 07 09:44 AM
Excel: Changing "numeric $" to "text $" in a different cell. Heather_CCF Excel Worksheet Functions 1 September 5th 06 06:06 PM
Changing "returned" values from "0" to "blank" LATATC Excel Worksheet Functions 2 October 20th 05 04:41 PM


All times are GMT +1. The time now is 03:57 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"