Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help needed - Change in userform...


i have a userform. In that userform there are some optionbuttons an
checkboxes. And i have a textbox in which i see the results accordin
to above mentioned buttons.

I want this textbox updated whenever there is a change in optionbutton
or checkboxes (I dont want to press the OK button to make th
calculations)

For example if there is such a sub like "Private Su
Userform1_Change()" , i can use it. But i could not find such a sub

Please help
Thanks in advanc

--
barkin
-----------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...fo&userid=2039
View this thread: http://www.excelforum.com/showthread.php?threadid=56638

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help needed - Change in userform...


Private Sub CheckBox1_Change()
TextBox1.Text = "Barkiny"
End Su

--
raypayett

-----------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...fo&userid=2956
View this thread: http://www.excelforum.com/showthread.php?threadid=56638

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Urgent help needed - Change in userform...

The boxes have Change and Clik events, call your code from those.

HTH. Best wishes Harald

"barkiny" skrev i
melding ...

i have a userform. In that userform there are some optionbuttons and
checkboxes. And i have a textbox in which i see the results according
to above mentioned buttons.

I want this textbox updated whenever there is a change in optionbuttons
or checkboxes (I dont want to press the OK button to make the
calculations)

For example if there is such a sub like "Private Sub
Userform1_Change()" , i can use it. But i could not find such a sub

Please help
Thanks in advance


--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=566387



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help needed - Change in userform...


thanks for your reply

But i have too many checkboxes and optionbuttons.I dont want to writ
for each of them like

Private Sub CheckBox1_Change()
Private Sub CheckBox2_Change()
Private Sub CheckBox3_Change()
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help needed - Change in userform...


I'm afraid you will have to have code for each control. Programming is
very precise.
If you think that is a lot of code, you should see programs in other
languages!


--
raypayette


------------------------------------------------------------------------
raypayette's Profile: http://www.excelforum.com/member.php...o&userid=29569
View this thread: http://www.excelforum.com/showthread...hreadid=566387



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help needed - Change in userform...


thanks for your reply herald
As i said there are too many boxes, I dont want to call one by on


--
barkiny
------------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=566387

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Urgent help needed - Change in userform...

Hi barkiny,

Search this ng for "WithEvents Checkbox", here's one pasted below -

" start copied post
Insert a class module named "Class1" and two command buttons near the bottom
of a userform.

'' start code in Class1
Public WithEvents cbx As MSForms.CheckBox

Private Sub cbx_Change()
MsgBox cbx.Tag & " : " & cbx.Value, , cbx.Name
'do stuff
End Sub

'' end code in Class1

''Start code in Userform1
Dim colClsChBoxes As New Collection

Private Sub CommandButton1_Click()
Dim cls As Class1
Dim cb As Control
For i = 1 To 3
Set cb = Me.Controls.Add("Forms.CheckBox.1", "My Check Box " & i, True)
With cb
..Left = 10
..Top = (i - 1) * 30 + 5
..Width = 90
..Height = 30
..Caption = .Name
End With
Set cls = New Class1
Set cls.cbx = cb


colClsChBoxes.Add cls
cb.Tag = colClsChBoxes.Count
Next


End Sub


Private Sub CommandButton2_Click()
Dim cnt As Long
Dim arr() As Boolean
cnt = colClsChBoxes.Count
If cnt Then
ReDim arr(1 To cnt)
For i = 1 To cnt
arr(i) = colClsChBoxes(i).cbx.Value
MsgBox arr(i), , colClsChBoxes(i).cbx.Name
Next
Else
MsgBox "No checkboxes in collection"
End If
End Sub


'' end code in Userform1

Class's for existing checkboxes could have course been instanciated and
added to the collection in the Intitialize event.

If you want to refer to the collection of class's (and hence checkboxes)
elsewhere in your project, declare colClsChBoxes as Public in a normal
module.
" end copied post

Now add a wide textbox named TexBox1, comment the msgbox line and replace
with

Dim s As String
s = cbx.Name & " Tag: " & cbx.Tag & " checked: " & cbx.Value
cbx.Parent.TextBox1.Text = s

Regards,
Peter T


"barkiny" wrote in
message ...

thanks for your reply herald
As i said there are too many boxes, I dont want to call one by one


--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=566387



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Urgent help needed - Change in userform...

It's not a question of what you want, it's a question of what needs to be
done to make it work. If you don't want to do it, hire someone to do it for
you, you're probably sufficiently exhausted after typing these replies, even
though you saved a little energy skipping the Shift key here and there.

Best wishes Harald

"barkiny" skrev i
melding ...

thanks for your reply herald
As i said there are too many boxes, I dont want to call one by one


--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=566387



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Urgent help needed - Change in userform...

you're [OP] probably sufficiently exhausted after typing these replies,
even
though you saved a little energy skipping the Shift key here and there.


The OP did say this was urgent, so he may not have had time to use the Shift
key !

Regards,
Peter T

"Harald Staff" wrote in message
...
It's not a question of what you want, it's a question of what needs to be
done to make it work. If you don't want to do it, hire someone to do it

for
you, you're probably sufficiently exhausted after typing these replies,

even
though you saved a little energy skipping the Shift key here and there.

Best wishes Harald

"barkiny" skrev i
melding ...

thanks for your reply herald
As i said there are too many boxes, I dont want to call one by one


--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

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

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





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
Urgent help needed please Bob Newman Excel Discussion (Misc queries) 5 January 15th 09 03:24 AM
URGENT HELP NEEDED ah Excel Discussion (Misc queries) 4 August 22nd 08 08:05 AM
urgent help needed please anyone Newbee[_2_] Excel Programming 2 February 23rd 06 08:22 PM
Urgent Help needed Brento Excel Discussion (Misc queries) 0 February 9th 06 09:10 PM
Urgent help needed! skarbanan Excel Worksheet Functions 23 December 30th 05 10:56 PM


All times are GMT +1. The time now is 04:44 AM.

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"