Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie, Variables not retained in sub?


Hey all,
Very new at teaching self VB in Excel.
Have created a simple loan repayment program (to learn with)
Got the basic 2 sheet code happening and am "prettying" it up.
Sheet 2 has a button to perform a Recalculate Option which works....BU
it doesn't retain the values within the sub??

Do I have to "pass parameters" to sub???
If so....how is that done?

NT

--
NT_eyeball
-----------------------------------------------------------------------
NT_eyeballs's Profile: http://www.excelforum.com/member.php...fo&userid=3180
View this thread: http://www.excelforum.com/showthread.php?threadid=51526

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Newbie, Variables not retained in sub?

Just Dim the variables outside the sub.
--
Gary's Student


"NT_eyeballs" wrote:


Hey all,
Very new at teaching self VB in Excel.
Have created a simple loan repayment program (to learn with)
Got the basic 2 sheet code happening and am "prettying" it up.
Sheet 2 has a button to perform a Recalculate Option which works....BUT
it doesn't retain the values within the sub??

Do I have to "pass parameters" to sub???
If so....how is that done?

NT.


--
NT_eyeballs
------------------------------------------------------------------------
NT_eyeballs's Profile: http://www.excelforum.com/member.php...o&userid=31802
View this thread: http://www.excelforum.com/showthread...hreadid=515262


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Newbie, Variables not retained in sub?

or make it a Static variable.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Gary''s Student" wrote in message
...
Just Dim the variables outside the sub.
--
Gary's Student


"NT_eyeballs" wrote:


Hey all,
Very new at teaching self VB in Excel.
Have created a simple loan repayment program (to learn with)
Got the basic 2 sheet code happening and am "prettying" it up.
Sheet 2 has a button to perform a Recalculate Option which works....BUT
it doesn't retain the values within the sub??

Do I have to "pass parameters" to sub???
If so....how is that done?

NT.


--
NT_eyeballs
------------------------------------------------------------------------
NT_eyeballs's Profile:

http://www.excelforum.com/member.php...o&userid=31802
View this thread:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie, Variables not retained in sub?


Hey all,
Thnx for replies.

The variables Are dim'd in main. So I must be doing something wrong.
The variable is loaded via Inputbox initially, and in the re-calc sub I
am trying to allow the same variable to be re-loaded via another
inputbox, but display previous value as Default.
I have tried using a ghost variable (copy) as the default (in case
inputbox statement is clearing it) and that doesn't work either.

NT.


--
NT_eyeballs
------------------------------------------------------------------------
NT_eyeballs's Profile: http://www.excelforum.com/member.php...o&userid=31802
View this thread: http://www.excelforum.com/showthread...hreadid=515262

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
row color is not being retained after saving spreadsheet Joe Murphy Excel Discussion (Misc queries) 0 September 25th 07 03:56 PM
Format & formula retained Ray Excel Worksheet Functions 1 December 12th 05 03:39 PM
Cell Content from UserForm Not Retained D.Parker Excel Discussion (Misc queries) 3 April 27th 05 04:56 PM
newbie ?: set variables, different shts, equal to each other terry b Excel Programming 11 February 28th 05 09:24 AM
Newbie Macro Query - Clearing Variables and Assigning a Variable Mcneilius[_5_] Excel Programming 3 September 5th 04 11:10 AM


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