Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Using values from macro to userform

Hi..

I have created a macro. One variable is defined there as:

dim var1_d as integer
var1_d=200

Then on the userform, I have a textbox (var1) and a checkbox (cvar1) next to
it.
Requirement:
When I click checkbox (cvar1), value of var1_d from macro should get copied
to textbox (var1).

My code is:

Private Sub cvar1_Click()

If cvar1 = True Then
UserForm1.var1.Value = var1_d

End If
End Sub

However it is not working. What is wrong in my code?

Thank you

Pawan


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default Using values from macro to userform

Don't dim the variable in the macro, but declare it at the top of the module
with

Public var1_d As Integer

--
__________________________________
HTH

Bob

"Pawan" wrote in message
...
Hi..

I have created a macro. One variable is defined there as:

dim var1_d as integer
var1_d=200

Then on the userform, I have a textbox (var1) and a checkbox (cvar1) next
to
it.
Requirement:
When I click checkbox (cvar1), value of var1_d from macro should get
copied
to textbox (var1).

My code is:

Private Sub cvar1_Click()

If cvar1 = True Then
UserForm1.var1.Value = var1_d

End If
End Sub

However it is not working. What is wrong in my code?

Thank you

Pawan




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Using values from macro to userform

Great.. I got it.. Thanks .. :-)

"Bob Phillips" wrote:

Don't dim the variable in the macro, but declare it at the top of the module
with

Public var1_d As Integer

--
__________________________________
HTH

Bob

"Pawan" wrote in message
...
Hi..

I have created a macro. One variable is defined there as:

dim var1_d as integer
var1_d=200

Then on the userform, I have a textbox (var1) and a checkbox (cvar1) next
to
it.
Requirement:
When I click checkbox (cvar1), value of var1_d from macro should get
copied
to textbox (var1).

My code is:

Private Sub cvar1_Click()

If cvar1 = True Then
UserForm1.var1.Value = var1_d

End If
End Sub

However it is not working. What is wrong in my code?

Thank you

Pawan





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
Can I use a UserForm Box with a Macro? Vick Excel Discussion (Misc queries) 3 May 18th 07 01:32 AM
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
Displaying cell values in a Userform michaelberrier Excel Discussion (Misc queries) 3 June 8th 06 05:24 PM
Userform for displaying values from a row jgmiddel Excel Discussion (Misc queries) 0 April 25th 06 09:00 PM
Userform/macro help chip_pyp Excel Discussion (Misc queries) 1 March 29th 06 07:38 PM


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