Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Combo box change

Hello!

I've got a userform where I feed text boxes and combo boxes from some fields
on a sheet each time that form is initialized. In the UserForm_Initialize
procedure I feed my combo box cb_status like this :

Private Sub UserForm_Initialize()
With cb_status
.RowSource = ""
.AddItem "P"
.AddItem "C"
.AddItem "N"
.AddItem "A"
End With
cb_status.Text = Cells(1, 3) 'Get the value already entered from the sheet
End Sub

This works perfectly, but the problem occurs when it reaches the
cb_status_Change because I've got conditions in there which I would like the
program to take action only when the user selects a value on one own. I see
that the program considers that when it brings the value from the sheet (when
initializing the userform) cb_status.Text = Cells(1, 3) it is considered like
a change.

Private Sub cb_status_Change()
If cb_status.Value = "A" Then
If MsgBox("Are you sure to cancel?", vbYesNo + vbQuestion) = vbYes
Then
frm_Bid.Enabled = False
Else
cb_status.Value = ""
End If
Else
frm_Bid.Enabled = True
End If
End Sub

How do I tell the program not to take action when it doesn't come from a
human action, but I still want to see the info from the sheet showing as the
value? I hope I am clear with my explainations...

Thanks for your help!
gmore

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Combo box change

I just used "AfterUpdate" in my combo box and it seems to work fine. Any
other suggestions are welcome.

"gmore" wrote:

Hello!

I've got a userform where I feed text boxes and combo boxes from some fields
on a sheet each time that form is initialized. In the UserForm_Initialize
procedure I feed my combo box cb_status like this :

Private Sub UserForm_Initialize()
With cb_status
.RowSource = ""
.AddItem "P"
.AddItem "C"
.AddItem "N"
.AddItem "A"
End With
cb_status.Text = Cells(1, 3) 'Get the value already entered from the sheet
End Sub

This works perfectly, but the problem occurs when it reaches the
cb_status_Change because I've got conditions in there which I would like the
program to take action only when the user selects a value on one own. I see
that the program considers that when it brings the value from the sheet (when
initializing the userform) cb_status.Text = Cells(1, 3) it is considered like
a change.

Private Sub cb_status_Change()
If cb_status.Value = "A" Then
If MsgBox("Are you sure to cancel?", vbYesNo + vbQuestion) = vbYes
Then
frm_Bid.Enabled = False
Else
cb_status.Value = ""
End If
Else
frm_Bid.Enabled = True
End If
End Sub

How do I tell the program not to take action when it doesn't come from a
human action, but I still want to see the info from the sheet showing as the
value? I hope I am clear with my explainations...

Thanks for your help!
gmore

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
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
Change of behavior in Combo Box Learning Excel Excel Discussion (Misc queries) 0 May 24th 08 05:00 PM
Using VB to change Combo box selection Richard Clayton[_2_] Excel Programming 0 October 8th 04 07:36 PM
Help with a Combo Box Change Event Ruan[_3_] Excel Programming 1 October 28th 03 08:51 AM
Before and after combo box change Dale[_7_] Excel Programming 1 October 7th 03 03:12 PM


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