Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I use a UserForm Box with a Macro? | Excel Discussion (Misc queries) | |||
Userform Initialize & combo box values | Excel Discussion (Misc queries) | |||
Displaying cell values in a Userform | Excel Discussion (Misc queries) | |||
Userform for displaying values from a row | Excel Discussion (Misc queries) | |||
Userform/macro help | Excel Discussion (Misc queries) |