PC Review


Reply
Thread Tools Rate Thread

Combo Box Showing Date Selections

 
 
TiredAlison
Guest
Posts: n/a
 
      19th Nov 2009
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.

 
Reply With Quote
 
 
 
 
TiredAlison
Guest
Posts: n/a
 
      20th Nov 2009

"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().

 
Reply With Quote
 
TiredAlison
Guest
Posts: n/a
 
      23rd Nov 2009


"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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box Selections KsFireworksGal Microsoft Access Forms 3 13th Aug 2008 04:17 PM
Date-range specific report with counted results of combo box selections Erin Microsoft Access 6 21st Apr 2007 10:13 PM
Combo Selections Pam Microsoft Access Forms 7 15th Mar 2006 07:44 PM
Combo Box Selections Karan Microsoft Access 1 10th Apr 2004 04:53 PM
Combo Box referring to selections of another combo box =?Utf-8?B?SmFpbWUgQW5kZXJzZW4=?= Microsoft Excel Worksheet Functions 0 7th Nov 2003 02:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:50 PM.