Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default ActiveX ComboBox Linked Cell

Is there a way to have an ActiveX ComboBox's LinkedCell output as a
number and not text ?


- Ronald K.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default ActiveX ComboBox Linked Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default ActiveX ComboBox Linked Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default ActiveX ComboBox Linked Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default ActiveX ComboBox Linked Cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default ActiveX ComboBox Linked Cell

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing linked cell runs ComboBox code hmm Excel Programming 1 August 21st 07 02:15 PM
publish activeX combobox and other activeX control irene c Excel Programming 0 March 19th 07 07:19 AM
VLOOKUP, linked cell &combobox Jaan Excel Worksheet Functions 0 December 11th 06 01:41 PM
Can I control linked cell property value in a copied ActiveX contr Beechbeard Excel Discussion (Misc queries) 0 May 4th 05 10:30 PM
Linked Cell Property In Activex controls KG Excel Discussion (Misc queries) 4 February 26th 05 10:37 PM


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"