Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to have an ActiveX ComboBox's LinkedCell output as a
number and not text ? - Ronald K. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
kittronald pretended :
Is there a way to have an ActiveX ComboBox's LinkedCell output as a number and not text ? - Ronald K. A combobox is a dropdown textbox, and so the answer to your Q is 'No'. You can, however, convert the value to the appropriate numeric type if IsNumeric(ComboBox1.Text)... With ComboBox1 If IsNumeric(.Text) Then CLng(.Text) 'convert to Long CInt(.Text) 'convert to Integer CDbl(.Text) 'convert to Double '... End If 'IsNumeric(.Text) End With 'ComboBox1 -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Garry,
After inserting a module with the code, the VBE opens and selects "With ComboBox1" with the error below: Compile error: Invalid outside procedure The combobox is named ComboBox1. - Ronald K. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
kittronald formulated the question :
Garry, After inserting a module with the code, the VBE opens and selects "With ComboBox1" with the error below: Compile error: Invalid outside procedure The combobox is named ComboBox1. - Ronald K. Well, the code should go behind the class that contains the combobox. This would be a userform or a worksheet. Otherwise, if you want to ref the combobox in a standard module then you need to prepend its parent object. Examples: With UserForm1.ComboBox1... or With Sheets("sheetname"[or index]).ComboBox1... If the code resides in the combobox's parent class: With Me.ComboBox1... -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Garry,
After inserting the code in its own module, I've tried prepending with: Forms.ComboBox.1 This is what displays in the formula box when I select the ActiveX ComboBox Sheet2.ComboBox1 Me.ComboBox1 Sheets("Settings").ComboBox1 None of these change the format of the linked cell. Does it matter if this an ActiveX Combobox instead of a forms Combobox ? - Ronald K. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
kittronald explained :
Garry, After inserting the code in its own module, I've tried prepending with: Forms.ComboBox.1 This is what displays in the formula box when I select the ActiveX ComboBox Sheet2.ComboBox1 Me.ComboBox1 Sheets("Settings").ComboBox1 None of these change the format of the linked cell. Does it matter if this an ActiveX Combobox instead of a forms Combobox ? - Ronald K. I don't understand why you're trying to change the format of its LinkedCell. I thought you wanted to use its Text as a numeric value, and so is why I provided examples of how to convert 'text as numbers' to actual numeric values. Also, to ref the combobox's LinkedCell property you need to append '.LinkedCell' to it in code. Example: Me.ComboBox1.LinkedCell = Me.Range("$C$1").Address To set ComboBox1.List: Me.ComboBox1.ListFillRange = Me.Range("$A$1:$A$5").Address These examples assume the code is behind the worksheet the combobox is on. (Which makes that sheet the combobox's 'Parent') -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing linked cell runs ComboBox code | Excel Programming | |||
publish activeX combobox and other activeX control | Excel Programming | |||
VLOOKUP, linked cell &combobox | Excel Worksheet Functions | |||
Can I control linked cell property value in a copied ActiveX contr | Excel Discussion (Misc queries) | |||
Linked Cell Property In Activex controls | Excel Discussion (Misc queries) |