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: 586
Default Automatically resest variable values = 0 after runtime

I have about 40 variables at the top of a Userforms Declaration section. I
do this because I need the variables calculated in one procedure and made
available to another procedure when they are all done being calulated.

The problem is I currently have to write code to reset all the variables
back to 0 before they are recalculated. If there a way to declare the
variable (DataType Single) = 0 at the beginning of runtime. For example:

Option Explicit

Dim var1 As Single = 0
Dim var2 As Single = 0

Private Sub CalculateVariables()

' code to calculate var1 & var2

End Sub

Private Sub UseVariables

' code to use var1 & var2

End Sub

After runtime var1 & var2 are reset to 0
--
Cheers,
Ryan
 
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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Runtime Error 91 Object variable or With block variable not set. Tim Excel Programming 9 June 5th 08 10:03 PM
Excel2003 - Automatically sum a variable number of rows AndrewT Excel Worksheet Functions 5 January 4th 08 11:17 AM
VBA automatically updating variable names Mike T[_2_] Excel Programming 3 March 31st 06 06:20 PM
Runtime error 91: Objust variable or with block.... paritoshmehta[_23_] Excel Programming 1 July 29th 04 01:57 PM


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