Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Drop Down Box


I currenly have a macro that runs and ends with an input box popping u
asking the user to enter yes or no. It goes as follows:

Range("N53").Value = InputBox("Yes or No")

However, as this is an input box the text is a free field and the ye
or no is just a title. To avoid errors on input (ie people pressing
for yes) i want this input box to be a drop down box, or i only wan
the user to be able to select the options i offer.

Any though

--
chalk
-----------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...fo&userid=2375
View this thread: http://www.excelforum.com/showthread.php?threadid=50110

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro Drop Down Box

Why not use a MsgBox

If MsgBox("Select Yes or No", vbYesNo) = vbYes Then
Range("N53").Value = "Yes"
Else
Range("N53").Value = "No"
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"chalky" wrote in
message ...

I currenly have a macro that runs and ends with an input box popping up
asking the user to enter yes or no. It goes as follows:

Range("N53").Value = InputBox("Yes or No")

However, as this is an input box the text is a free field and the yes
or no is just a title. To avoid errors on input (ie people pressing Y
for yes) i want this input box to be a drop down box, or i only want
the user to be able to select the options i offer.

Any thoughs


--
chalky
------------------------------------------------------------------------
chalky's Profile:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Macro Drop Down Box

One way to do it would be to use a ComboBox instead of a TextBox.

"chalky" wrote:


I currenly have a macro that runs and ends with an input box popping up
asking the user to enter yes or no. It goes as follows:

Range("N53").Value = InputBox("Yes or No")

However, as this is an input box the text is a free field and the yes
or no is just a title. To avoid errors on input (ie people pressing Y
for yes) i want this input box to be a drop down box, or i only want
the user to be able to select the options i offer.

Any thoughs


--
chalky
------------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...o&userid=23758
View this thread: http://www.excelforum.com/showthread...hreadid=501107


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Drop Down Box


The msgbox idea worked perfectly thanks! One think i wanted to add
though was further options, ie yes, no, maybe (amongst others).

Any ideas on how this would work? I can't say i am familiar with the
combobox.

Thanks for your help so far

chris


--
chalky
------------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...o&userid=23758
View this thread: http://www.excelforum.com/showthread...hreadid=501107

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro Drop Down Box

I am afraid that you cannot have Maybe as this technique uses built-in
buttons, but you could use Cancel

Dim ans As Long
ans = MsgBox("Select Yes or No", vbYesNoCancel)
If ans = vbYes Then
Range("N53").Value = "Yes"
ElseIf ans = vbNo Then
Range("N53").Value = "No"
Else
Range("N53").Value = "Maybe"
End If



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"chalky" wrote in
message ...

The msgbox idea worked perfectly thanks! One think i wanted to add
though was further options, ie yes, no, maybe (amongst others).

Any ideas on how this would work? I can't say i am familiar with the
combobox.

Thanks for your help so far

chris


--
chalky
------------------------------------------------------------------------
chalky's Profile:

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Drop Down Box


Thanks for your reply, i will look into how this might be incorporated.
I am pretty sure it will keep things ticking over for the time being.

Thanks
chris


--
chalky
------------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...o&userid=23758
View this thread: http://www.excelforum.com/showthread...hreadid=501107

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
Macro with Drop Down Box Maggie Excel Discussion (Misc queries) 1 February 20th 07 10:00 PM
Drop down list macro? soteman Excel Discussion (Misc queries) 1 August 12th 06 01:54 AM
Macro to add drop-down lists comparini3000 Excel Discussion (Misc queries) 1 June 8th 06 01:20 AM
Drop Down Box & Macro A.S. Excel Discussion (Misc queries) 3 January 24th 06 04:21 PM
Macro that changes Drop Down Box peekbo[_5_] Excel Programming 5 July 8th 04 03:59 AM


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