Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default using a variable in a function

Hi
i have this
Public antal As Integer ' in decalration in the form

then i have this in a command button
antal = DateValue(sdage.Value) - DateValue(dage.Value)
antaldage.Value = antal

Its working

Now i want to use the value of antal in a function , i run in another comman
button

But here it is emty Why???


resgards

Alvin


  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default using a variable in a function

your variable is only public within the form, if the function is in a
seperate form OR module then the function creates a new instance of the
variable.
Try sharing your variable as public in a Regular Code Module as Public, This
will share it for the whole Project.
Also see VBA on 'Life of Variables'
--
When you lose your mind, you free your life.


"alvin Kuiper" wrote:

Hi
i have this
Public antal As Integer ' in decalration in the form

then i have this in a command button
antal = DateValue(sdage.Value) - DateValue(dage.Value)
antaldage.Value = antal

Its working

Now i want to use the value of antal in a function , i run in another comman
button

But here it is emty Why???


resgards

Alvin


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default using a variable in a function

Thanks

Alvin

"ben" wrote:

your variable is only public within the form, if the function is in a
seperate form OR module then the function creates a new instance of the
variable.
Try sharing your variable as public in a Regular Code Module as Public, This
will share it for the whole Project.
Also see VBA on 'Life of Variables'
--
When you lose your mind, you free your life.


"alvin Kuiper" wrote:

Hi
i have this
Public antal As Integer ' in decalration in the form

then i have this in a command button
antal = DateValue(sdage.Value) - DateValue(dage.Value)
antaldage.Value = antal

Its working

Now i want to use the value of antal in a function , i run in another comman
button

But here it is emty Why???


resgards

Alvin


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
Variable Sum Function David G. Excel Discussion (Misc queries) 9 December 29th 08 08:34 PM
Variable function ESP Tom Excel Discussion (Misc queries) 1 July 10th 06 09:37 PM
Variable function ESP Tom Excel Discussion (Misc queries) 0 July 10th 06 02:15 PM
Using variable in a function alvin Kuiper Excel Programming 0 February 8th 06 09:43 PM
Set variable to a function Dan Excel Programming 3 June 11th 04 03:09 PM


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