Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Combo Box Showing Date Selections

Hi
I have a spreadsheet with a combo box setup. I want it to display in the
pull down dates in the format dd/mm/yy from todays date - 5 days to todays
date + 30 days. I have searched the help and discussion post and found code
to get it to pull down in the format mm/dd/yy from a specific date but I am
not clever enough to alter this to what I want. If you want me to post the
code I have so far let me know.
thanking you in advance for this help.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default Combo Box Showing Date Selections

TiredAlison wrote:
Hi
I have a spreadsheet with a combo box setup. I want it to display in the
pull down dates in the format dd/mm/yy from todays date - 5 days to todays
date + 30 days. I have searched the help and discussion post and found code
to get it to pull down in the format mm/dd/yy from a specific date but I am
not clever enough to alter this to what I want. If you want me to post the
code I have so far let me know.
thanking you in advance for this help.


If you are using the VB combo, you could try something like this:

For i = -5 To 30
Sheet1.ComboBox1.AddItem Format(Date + i, "dd/mm/yyyy")
Next i
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Combo Box Showing Date Selections


"smartin" wrote:

TiredAlison wrote:
Hi
I have a spreadsheet with a combo box setup. I want it to display in the
pull down dates in the format dd/mm/yy from todays date - 5 days to todays
date + 30 days. I have searched the help and discussion post and found code
to get it to pull down in the format mm/dd/yy from a specific date but I am
not clever enough to alter this to what I want. If you want me to post the
code I have so far let me know.
thanking you in advance for this help.


If you are using the VB combo, you could try something like this:

For i = -5 To 30
Sheet1.ComboBox1.AddItem Format(Date + i, "dd/mm/yyyy")
Next i
.
Thanks for your help but when I cleared out all my code and only put your code in it doesn't display anything in the pulldown. When I try and type a value I get "Compile Error. Method or data member not found". I entered the code by going into design mode and view code. It called the subroutine ComboBox1_Change().

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default Combo Box Showing Date Selections

TiredAlison wrote:
"smartin" wrote:

TiredAlison wrote:
Hi
I have a spreadsheet with a combo box setup. I want it to display in the
pull down dates in the format dd/mm/yy from todays date - 5 days to todays
date + 30 days. I have searched the help and discussion post and found code
to get it to pull down in the format mm/dd/yy from a specific date but I am
not clever enough to alter this to what I want. If you want me to post the
code I have so far let me know.
thanking you in advance for this help.

If you are using the VB combo, you could try something like this:

For i = -5 To 30
Sheet1.ComboBox1.AddItem Format(Date + i, "dd/mm/yyyy")
Next i
.
Thanks for your help but when I cleared out all my code and only put your code in it doesn't display anything in the pulldown. When I try and type a value I get "Compile Error. Method or data member not found". I entered the code by going into design mode and view code. It called the subroutine ComboBox1_Change().


Try using a more generic event procedure, not one specific to the
combobox itself. Something like worksheet_activate. You can get there by
double-clicking "Sheet1" in the VBA Project navigator.

Then, from the two comboboxes above the code window (the ones that say
"(General)" and "(Declarations)" by default), pick Worksheet and
Activate, and paste the suggested code in the Sub stub.

Return to the workbook, toggle to some other worksheet and back again.
Check the combo. Any luck?
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Combo Box Showing Date Selections



"smartin" wrote:

TiredAlison wrote:
"smartin" wrote:

TiredAlison wrote:
Hi
I have a spreadsheet with a combo box setup. I want it to display in the
pull down dates in the format dd/mm/yy from todays date - 5 days to todays
date + 30 days. I have searched the help and discussion post and found code
to get it to pull down in the format mm/dd/yy from a specific date but I am
not clever enough to alter this to what I want. If you want me to post the
code I have so far let me know.
thanking you in advance for this help.
If you are using the VB combo, you could try something like this:

For i = -5 To 30
Sheet1.ComboBox1.AddItem Format(Date + i, "dd/mm/yyyy")
Next i
.
Thanks for your help but when I cleared out all my code and only put your code in it doesn't display anything in the pulldown. When I try and type a value I get "Compile Error. Method or data member not found". I entered the code by going into design mode and view code. It called the subroutine ComboBox1_Change().


Try using a more generic event procedure, not one specific to the
combobox itself. Something like worksheet_activate. You can get there by
double-clicking "Sheet1" in the VBA Project navigator.

Then, from the two comboboxes above the code window (the ones that say
"(General)" and "(Declarations)" by default), pick Worksheet and
Activate, and paste the suggested code in the Sub stub.

Return to the workbook, toggle to some other worksheet and back again.
Check the combo. Any luck?
.

No luck .. when I swapped to an alternate sheet it gave "Compile Error.
Method or data member not found" and .Combox1 went blue. When I close the
debugger and go back to original sheet it seems OK but there is nothing in
the pull down.

Code used wass as follows:

Private Sub Worksheet_Activate()
For i = -5 To 30
Sheet1.ComboBox1.AddItem Format(Date + i, "dd/mm/yyyy")
Next i
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub



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
Combo box showing row number only Skeletor Excel Worksheet Functions 1 September 27th 09 11:25 PM
Counting Combo Drop Down Box Selections Jeff Excel Worksheet Functions 1 April 16th 08 08:38 PM
Multiple combo boxes with unique duplicates showing only Nemo New Users to Excel 0 July 6th 07 03:20 PM
Can List or Combo Box have multiple selections? [email protected] Excel Worksheet Functions 2 April 6th 06 03:41 PM
Combo Box Showing numbers not dates Mo Excel Discussion (Misc queries) 1 December 14th 04 05:39 PM


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