ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format in a combobox (https://www.excelbanter.com/excel-programming/353081-format-combobox.html)

alvin Kuiper

Format in a combobox
 
Hi
I have again a problem whith format
i have yhis
Dim rng2 As Range
Set rng2 = Range(Range("Ark1!a1"), Range("ark1!a1").End(xlDown))
Me.combo_sedatoer.List = rng2.Value

The value in my range is date
And in the sheet the value is dd-mm-yyyy
But in the combobox the value are mm/dd/yyyy

I have try to use format "dd-mm-yyyy" but don't know where to do this
i get a error when i try
So maybe someone can help?

Alvin


Toppers

Format in a combobox
 
Hi,

This solved it for me ( I use UK date formats):

Me.combo_sedatoer.rowsource = rng2.address

"alvin Kuiper" wrote:

Hi
I have again a problem whith format
i have yhis
Dim rng2 As Range
Set rng2 = Range(Range("Ark1!a1"), Range("ark1!a1").End(xlDown))
Me.combo_sedatoer.List = rng2.Value

The value in my range is date
And in the sheet the value is dd-mm-yyyy
But in the combobox the value are mm/dd/yyyy

I have try to use format "dd-mm-yyyy" but don't know where to do this
i get a error when i try
So maybe someone can help?

Alvin


alvin Kuiper

Format in a combobox
 
Hi topper
yes the right date comes
but when you choose a value
the value in the combobox become a number??

Alvin


"Toppers" wrote:

Hi,

This solved it for me ( I use UK date formats):

Me.combo_sedatoer.rowsource = rng2.address

"alvin Kuiper" wrote:

Hi
I have again a problem whith format
i have yhis
Dim rng2 As Range
Set rng2 = Range(Range("Ark1!a1"), Range("ark1!a1").End(xlDown))
Me.combo_sedatoer.List = rng2.Value

The value in my range is date
And in the sheet the value is dd-mm-yyyy
But in the combobox the value are mm/dd/yyyy

I have try to use format "dd-mm-yyyy" but don't know where to do this
i get a error when i try
So maybe someone can help?

Alvin


Toppers

Format in a combobox
 
Try:

Private Sub ComboBox1_Change()
ComboBox1.Value = Format(CDate(ComboBox1.Text), "dd-mm-yyyy")
End Sub

"alvin Kuiper" wrote:

Hi topper
yes the right date comes
but when you choose a value
the value in the combobox become a number??

Alvin


"Toppers" wrote:

Hi,

This solved it for me ( I use UK date formats):

Me.combo_sedatoer.rowsource = rng2.address

"alvin Kuiper" wrote:

Hi
I have again a problem whith format
i have yhis
Dim rng2 As Range
Set rng2 = Range(Range("Ark1!a1"), Range("ark1!a1").End(xlDown))
Me.combo_sedatoer.List = rng2.Value

The value in my range is date
And in the sheet the value is dd-mm-yyyy
But in the combobox the value are mm/dd/yyyy

I have try to use format "dd-mm-yyyy" but don't know where to do this
i get a error when i try
So maybe someone can help?

Alvin


alvin Kuiper

Format in a combobox
 
Thanks.

Alvin


"Toppers" wrote:

Try:

Private Sub ComboBox1_Change()
ComboBox1.Value = Format(CDate(ComboBox1.Text), "dd-mm-yyyy")
End Sub

"alvin Kuiper" wrote:

Hi topper
yes the right date comes
but when you choose a value
the value in the combobox become a number??

Alvin


"Toppers" wrote:

Hi,

This solved it for me ( I use UK date formats):

Me.combo_sedatoer.rowsource = rng2.address

"alvin Kuiper" wrote:

Hi
I have again a problem whith format
i have yhis
Dim rng2 As Range
Set rng2 = Range(Range("Ark1!a1"), Range("ark1!a1").End(xlDown))
Me.combo_sedatoer.List = rng2.Value

The value in my range is date
And in the sheet the value is dd-mm-yyyy
But in the combobox the value are mm/dd/yyyy

I have try to use format "dd-mm-yyyy" but don't know where to do this
i get a error when i try
So maybe someone can help?

Alvin



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com