ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem formatting decimals in ComboBox (https://www.excelbanter.com/excel-programming/372281-problem-formatting-decimals-combobox.html)

TylerTheCoderGuy

Problem formatting decimals in ComboBox
 
Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler


TylerTheCoderGuy

Problem formatting decimals in ComboBox
 
I just realized that my code works in the English (United States)
Language Region formatting, but it is giving me errors when I switch to
German Language Region.

TylerTheCoderGuy wrote:
Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler



Tom Ogilvy

Problem formatting decimals in ComboBox
 
Have you configured the combobox in some way so it doesn't allow the
assignment? does the value match a value in the dropdown list. Is the list
single column? have you used the boundcolumn or textcolumn properties. Have
you enforced matching. Just some things to look at as well as other
properties.

--
Regards,
Tom Ogilvy


"TylerTheCoderGuy" wrote:

Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler



Tyler[_3_]

Problem formatting decimals in ComboBox
 

Tom Ogilvy wrote:
Have you configured the combobox in some way so it doesn't allow the
assignment? does the value match a value in the dropdown list. Is the list
single column? have you used the boundcolumn or textcolumn properties. Have
you enforced matching. Just some things to look at as well as other
properties.

--
Regards,
Tom Ogilvy


"TylerTheCoderGuy" wrote:

Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler




Tyler[_3_]

Problem formatting decimals in ComboBox
 
Thanks Tom - I deleted the comboBox and put in a new one and the
default values allowed this to work in both German and English regional
languages. Thanks!

Another problem has arisen and I can't find the root of it:

In German regional language settings, if I select anything greater than
0.999 it will eliminate the decimal seperator. For example:

I select 0,999 from the list, and it will show 0,999 after I leave
focus
I select 1,000 from the list, and it will show 1000 after I leave focus

This is storing as 1000 in the worksheet too, and it's screwing up the
numbers! Only happening in European regional language settings...


Tom Ogilvy wrote:
Have you configured the combobox in some way so it doesn't allow the
assignment? does the value match a value in the dropdown list. Is the list
single column? have you used the boundcolumn or textcolumn properties. Have
you enforced matching. Just some things to look at as well as other
properties.

--
Regards,
Tom Ogilvy


"TylerTheCoderGuy" wrote:

Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler




Tom Ogilvy

Problem formatting decimals in ComboBox
 
Not having a German version, I would break the link and manage it with code.

However, you might get a better answer from someone who actually deals with
that problem.

I would post this as a new topic (there are people from many european
countries who post) or try posting in a German language excel related
newsgroup.

--
Regards,
Tom Ogilvy





"Tyler" wrote:

Thanks Tom - I deleted the comboBox and put in a new one and the
default values allowed this to work in both German and English regional
languages. Thanks!

Another problem has arisen and I can't find the root of it:

In German regional language settings, if I select anything greater than
0.999 it will eliminate the decimal seperator. For example:

I select 0,999 from the list, and it will show 0,999 after I leave
focus
I select 1,000 from the list, and it will show 1000 after I leave focus

This is storing as 1000 in the worksheet too, and it's screwing up the
numbers! Only happening in European regional language settings...


Tom Ogilvy wrote:
Have you configured the combobox in some way so it doesn't allow the
assignment? does the value match a value in the dropdown list. Is the list
single column? have you used the boundcolumn or textcolumn properties. Have
you enforced matching. Just some things to look at as well as other
properties.

--
Regards,
Tom Ogilvy


"TylerTheCoderGuy" wrote:

Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler





Tyler[_3_]

Problem formatting decimals in ComboBox
 
Cool I'll give that a try.

Also - just an FYI - I go to Windows-- Control Panel -- and go to the
Languages and Regions and change it from USA to German. I have the
English version myself.


Tom Ogilvy wrote:
Not having a German version, I would break the link and manage it with code.

However, you might get a better answer from someone who actually deals with
that problem.

I would post this as a new topic (there are people from many european
countries who post) or try posting in a German language excel related
newsgroup.

--
Regards,
Tom Ogilvy





"Tyler" wrote:

Thanks Tom - I deleted the comboBox and put in a new one and the
default values allowed this to work in both German and English regional
languages. Thanks!

Another problem has arisen and I can't find the root of it:

In German regional language settings, if I select anything greater than
0.999 it will eliminate the decimal seperator. For example:

I select 0,999 from the list, and it will show 0,999 after I leave
focus
I select 1,000 from the list, and it will show 1000 after I leave focus

This is storing as 1000 in the worksheet too, and it's screwing up the
numbers! Only happening in European regional language settings...


Tom Ogilvy wrote:
Have you configured the combobox in some way so it doesn't allow the
assignment? does the value match a value in the dropdown list. Is the list
single column? have you used the boundcolumn or textcolumn properties. Have
you enforced matching. Just some things to look at as well as other
properties.

--
Regards,
Tom Ogilvy


"TylerTheCoderGuy" wrote:

Hello,

I have the following line of code in the UserForm_Initialize() section
to show a 3-decimal placeholder in the selected item of the combobox:

comboBox1.Text = FormatNumber((Worksheets("Worksheet1").Cells(13,
5).Value), 3)

I am getting the error message: "Run-time error '380': Could not set
the Text property. Invalid property value."

Does anybody have any ideas as to what would be causing this error?

Best regards,
Tyler







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

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