Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default coding worksheets for undesired selections

I am in the process of building a complex workbook.
Within the workbook is several worksheets. Each worksheet
has several ComboBoxes that allow the user to make a
selection of several options. However, some of the
options do not relate. My task is to code the sheet so
that unrelated choices are not an option or when a
selection is made that does not relate to a previous
selection then a Msgbox will appear and tell the user
what to change. Below is an example of what is included.
multiple ComboBoxes each with a formula string that
includes VLookups from tables within the worksheet.
Example.
ComboBox 1 will include the following options:
8
16
12
32
40
48
ComboBox 2 will include the following:
Stitch
Perfect
Paste

If the user choses any number over 16 in ComboBox 1 and
then chooses "Paste" from ComboBox 2 I need to do 1 of 2
things.
I need either Paste to not be an option if 16 or higher
is chosen OR I need a MsgBox explaining the problem.
Many thanks to anyone who can point me in the right
direction for this or who knows the code I am looking
for.
Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default coding worksheets for undesired selections

Private Sub combobox1_Click()
if Combobox1.ListIndex 2 then
if combobox2.ListFillRange = "" then
Combobox2.RemoveItem 2
end if
end sub

Private Sub Combobox2_click()
if Combobox1.ListIndex 2 and Combobox2.Value = "Paste" then
msgbox "Paste is not a option for you"
Combobox2.ListIndex = -1
end if
End Sub


You can't remove an item if the box is populated using ListfillRange

in the special case where the last item in the list is the only one to be
excluded

What if the user changes their mind and changes the selection in Combobox1?

--
Regards,
Tom Ogilvy


"Ed" wrote in message
...
I am in the process of building a complex workbook.
Within the workbook is several worksheets. Each worksheet
has several ComboBoxes that allow the user to make a
selection of several options. However, some of the
options do not relate. My task is to code the sheet so
that unrelated choices are not an option or when a
selection is made that does not relate to a previous
selection then a Msgbox will appear and tell the user
what to change. Below is an example of what is included.
multiple ComboBoxes each with a formula string that
includes VLookups from tables within the worksheet.
Example.
ComboBox 1 will include the following options:
8
16
12
32
40
48
ComboBox 2 will include the following:
Stitch
Perfect
Paste

If the user choses any number over 16 in ComboBox 1 and
then chooses "Paste" from ComboBox 2 I need to do 1 of 2
things.
I need either Paste to not be an option if 16 or higher
is chosen OR I need a MsgBox explaining the problem.
Many thanks to anyone who can point me in the right
direction for this or who knows the code I am looking
for.
Ed



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default coding worksheets for undesired selections

Tom,
Just wanted to thank you for your help. To answer your
question. I was thinking that once the user changed their
mind and changed ComboBox 1 then ComboBox 2 would
repopulate with the option that had been previously left
out.
Thanks again for your help.
Ed
-----Original Message-----
Private Sub combobox1_Click()
if Combobox1.ListIndex 2 then
if combobox2.ListFillRange = "" then
Combobox2.RemoveItem 2
end if
end sub

Private Sub Combobox2_click()
if Combobox1.ListIndex 2 and Combobox2.Value

= "Paste" then
msgbox "Paste is not a option for you"
Combobox2.ListIndex = -1
end if
End Sub


You can't remove an item if the box is populated using

ListfillRange

in the special case where the last item in the list is

the only one to be
excluded

What if the user changes their mind and changes the

selection in Combobox1?

--
Regards,
Tom Ogilvy


"Ed" wrote in message
...
I am in the process of building a complex workbook.
Within the workbook is several worksheets. Each

worksheet
has several ComboBoxes that allow the user to make a
selection of several options. However, some of the
options do not relate. My task is to code the sheet so
that unrelated choices are not an option or when a
selection is made that does not relate to a previous
selection then a Msgbox will appear and tell the user
what to change. Below is an example of what is

included.
multiple ComboBoxes each with a formula string that
includes VLookups from tables within the worksheet.
Example.
ComboBox 1 will include the following options:
8
16
12
32
40
48
ComboBox 2 will include the following:
Stitch
Perfect
Paste

If the user choses any number over 16 in ComboBox 1 and
then chooses "Paste" from ComboBox 2 I need to do 1 of

2
things.
I need either Paste to not be an option if 16 or higher
is chosen OR I need a MsgBox explaining the problem.
Many thanks to anyone who can point me in the right
direction for this or who knows the code I am looking
for.
Ed



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default coding worksheets for undesired selections

Private Sub combobox1_Click()
Combobox2.ListFillRange = ""
if Combobox1.ListIndex 2 then
Combobox2.List = Array("Stitch","Perfect")
else
Combobox2.List = Array("Stitch","Perfect","Paste")
end if
end sub

--
Regards,
Tom Ogilvy



"Ed" wrote in message
...
Tom,
Just wanted to thank you for your help. To answer your
question. I was thinking that once the user changed their
mind and changed ComboBox 1 then ComboBox 2 would
repopulate with the option that had been previously left
out.
Thanks again for your help.
Ed
-----Original Message-----
Private Sub combobox1_Click()
if Combobox1.ListIndex 2 then
if combobox2.ListFillRange = "" then
Combobox2.RemoveItem 2
end if
end sub

Private Sub Combobox2_click()
if Combobox1.ListIndex 2 and Combobox2.Value

= "Paste" then
msgbox "Paste is not a option for you"
Combobox2.ListIndex = -1
end if
End Sub


You can't remove an item if the box is populated using

ListfillRange

in the special case where the last item in the list is

the only one to be
excluded

What if the user changes their mind and changes the

selection in Combobox1?

--
Regards,
Tom Ogilvy


"Ed" wrote in message
...
I am in the process of building a complex workbook.
Within the workbook is several worksheets. Each

worksheet
has several ComboBoxes that allow the user to make a
selection of several options. However, some of the
options do not relate. My task is to code the sheet so
that unrelated choices are not an option or when a
selection is made that does not relate to a previous
selection then a Msgbox will appear and tell the user
what to change. Below is an example of what is

included.
multiple ComboBoxes each with a formula string that
includes VLookups from tables within the worksheet.
Example.
ComboBox 1 will include the following options:
8
16
12
32
40
48
ComboBox 2 will include the following:
Stitch
Perfect
Paste

If the user choses any number over 16 in ComboBox 1 and
then chooses "Paste" from ComboBox 2 I need to do 1 of

2
things.
I need either Paste to not be an option if 16 or higher
is chosen OR I need a MsgBox explaining the problem.
Many thanks to anyone who can point me in the right
direction for this or who knows the code I am looking
for.
Ed



.



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
On exit from edit, Excel jumps to remote undesired cell. [email protected] Excel Discussion (Misc queries) 2 July 21st 08 12:15 PM
Undesired links: Pasting from one excel document to another ProS Links and Linking in Excel 1 December 30th 07 08:35 PM
undesired "breaks" between worksheets KC Rippstein hotmail com> Excel Discussion (Misc queries) 1 November 8th 07 06:11 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Undesired Rounding in VBA; accumulating values Glenn Ray Excel Programming 5 January 25th 04 10:01 PM


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