PC Review


Reply
Thread Tools Rate Thread

Combobox number formats

 
 
Steve
Guest
Posts: n/a
 
      23rd Oct 2007
HYCH
Am using the code below, to pull back the a list of Times (format
hh:mm)

But still shows as decimal numbers


any help please !!!


Private Sub UserForm_Initialize()
Dim cPart As Range
Dim ws As Worksheet
Set ws = Worksheets("Lists")
For Each cPart In ws.Range("C1:C88")
With Me.ComboBox1
.AddItem cPart.Value
.List(.ListCount - 1, 1) = Format(cPart.Offset(0, 1).Value,
"hh:mm")
End With
Next cPart
Me.ComboBox1.Value = ""
Me.ComboBox1.SetFocus
End Sub


Steve

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U21hbGx3ZWVk?=
Guest
Posts: n/a
 
      23rd Oct 2007
The .AddItem line is what's adding the text to the combo box - shouldn't this
be where you put Format(cPart.Value, "hh:mm")?

"Steve" wrote:

> HYCH
> Am using the code below, to pull back the a list of Times (format
> hh:mm)
>
> But still shows as decimal numbers
>
>
> any help please !!!
>
>
> Private Sub UserForm_Initialize()
> Dim cPart As Range
> Dim ws As Worksheet
> Set ws = Worksheets("Lists")
> For Each cPart In ws.Range("C1:C88")
> With Me.ComboBox1
> .AddItem cPart.Value
> .List(.ListCount - 1, 1) = Format(cPart.Offset(0, 1).Value,
> "hh:mm")
> End With
> Next cPart
> Me.ComboBox1.Value = ""
> Me.ComboBox1.SetFocus
> End Sub
>
>
> Steve
>
>

 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      23rd Oct 2007
On 23 Oct, 12:44, Smallweed <Smallw...@discussions.microsoft.com>
wrote:
> The .AddItem line is what's adding the text to the combo box - shouldn't this
> be where you put Format(cPart.Value, "hh:mm")?
>
>
>
> "Steve" wrote:
> > HYCH
> > Am using the code below, to pull back the a list of Times (format
> > hh:mm)

>
> > But still shows as decimal numbers

>
> > any help please !!!

>
> > Private Sub UserForm_Initialize()
> > Dim cPart As Range
> > Dim ws As Worksheet
> > Set ws = Worksheets("Lists")
> > For Each cPart In ws.Range("C1:C88")
> > With Me.ComboBox1
> > .AddItem cPart.Value
> > .List(.ListCount - 1, 1) = Format(cPart.Offset(0, 1).Value,
> > "hh:mm")
> > End With
> > Next cPart
> > Me.ComboBox1.Value = ""
> > Me.ComboBox1.SetFocus
> > End Sub

>
> > Steve- Hide quoted text -

>
> - Show quoted text -


What a star, of course, thanks Small



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      23rd Oct 2007
See one answer in microsoft.public.excel

Please don't post the same question to multiple newsgroups. It tends to
fragment any answers you get, and it potentially wastes the time of
those responding to questions that have already been answered in another
group.

In article <(E-Mail Removed)>,
Steve <(E-Mail Removed)> wrote:

> HYCH
> Am using the code below, to pull back the a list of Times (format
> hh:mm)
>
> But still shows as decimal numbers
>
>
> any help please !!!
>
>
> Private Sub UserForm_Initialize()
> Dim cPart As Range
> Dim ws As Worksheet
> Set ws = Worksheets("Lists")
> For Each cPart In ws.Range("C1:C88")
> With Me.ComboBox1
> .AddItem cPart.Value
> .List(.ListCount - 1, 1) = Format(cPart.Offset(0, 1).Value,
> "hh:mm")
> End With
> Next cPart
> Me.ComboBox1.Value = ""
> Me.ComboBox1.SetFocus
> End Sub
>
>
> Steve

 
Reply With Quote
 
Steve
Guest
Posts: n/a
 
      23rd Oct 2007
On 23 Oct, 12:53, JE McGimpsey <jemcgimp...@mvps.org> wrote:
> See one answer in microsoft.public.excel
>
> Please don't post the same question to multiple newsgroups. It tends to
> fragment any answers you get, and it potentially wastes the time of
> those responding to questions that have already been answered in another
> group.
>
> In article <1193138866.923016.82...@v23g2000prn.googlegroups.com>,
>
>
>
> Steve <instruct...@hotmail.com> wrote:
> > HYCH
> > Am using the code below, to pull back the a list of Times (format
> > hh:mm)

>
> > But still shows as decimal numbers

>
> > any help please !!!

>
> > Private Sub UserForm_Initialize()
> > Dim cPart As Range
> > Dim ws As Worksheet
> > Set ws = Worksheets("Lists")
> > For Each cPart In ws.Range("C1:C88")
> > With Me.ComboBox1
> > .AddItem cPart.Value
> > .List(.ListCount - 1, 1) = Format(cPart.Offset(0, 1).Value,
> > "hh:mm")
> > End With
> > Next cPart
> > Me.ComboBox1.Value = ""
> > Me.ComboBox1.SetFocus
> > End Sub

>
> > Steve- Hide quoted text -

>
> - Show quoted text -


Sorry JE,

Misc, seems to be very slow just recently, and meant to poast it here.

apologies

 
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
Number Formats Matt Microsoft Excel Misc 4 17th May 2007 06:35 PM
Combobox Number Formats =?Utf-8?B?TG9zdEluVkJB?= Microsoft Excel Worksheet Functions 0 30th Jun 2005 09:11 PM
How do I set number formats that will be applied only if a number. =?Utf-8?B?SmltIEdlbnRpbGU=?= Microsoft Excel Misc 3 6th Oct 2004 04:43 PM
How do I set number formats that will be applied only if a number. =?Utf-8?B?SmltIEdlbnRpbGU=?= Microsoft Excel Misc 1 6th Oct 2004 04:04 PM
Number Formats greasyboy6 Microsoft Excel Misc 4 20th Jun 2004 06:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.