Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
checkBox & ListBox on ToolBar...
Is that possible to have an checkBox and/or ListBox on
the toolbar.... so the code bellow will be run if checkBox is check, and listBox pointing to currency... Thank You / How to modify the content of the current Cell in Excel // put this code in Excel/VisualBasic/MsProject/ExCellObject/Worksheet1 Private Sub Worksheet_Change(ByVal Target As Range) Dim x As String x = Target.Value If Right(x, 1) = "*" Then Target.Value = Replace(x, "*", "000") End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
checkBox & ListBox on ToolBar...
this needs tweaking, but is enough to get you started:
Option Explicit Global drpdwn As CommandBarComboBox Sub SetMenuBar() Dim newbar As CommandBar Dim cntrl As CommandBarButton If BarExists Then CommandBars("Patrick").Delete End If Set newbar = CommandBars.Add("Patrick", msoBarFloating) Set drpdwn = newbar.Controls.Add(msoControlComboBox) With drpdwn .Caption = "Currency" .AddItem "USD" .AddItem "EUR" .AddItem "JPY" End With Set cntrl = newbar.Controls.Add(msoControlButton) With cntrl .Caption = "Run FX" .OnAction = "RunFX" End With newbar.Visible = True End Sub Function BarExists() As Boolean On Error Resume Next Dim cb As CommandBar Set cb = CommandBars("Patrick") BarExists = Err.Number = 0 On Error GoTo 0 End Function Sub RunFX() Dim ccy As String ' YOUR CODE HERE If drpdwn Is Nothing Then SetMenuBar If drpdwn.Text = "" Then ccy = "*" Else ccy = drpdwn.Text End If End Sub "Johan2000" wrote: Is that possible to have an checkBox and/or ListBox on the toolbar.... so the code bellow will be run if checkBox is check, and listBox pointing to currency... Thank You / How to modify the content of the current Cell in Excel // put this code in Excel/VisualBasic/MsProject/ExCellObject/Worksheet1 Private Sub Worksheet_Change(ByVal Target As Range) Dim x As String x = Target.Value If Right(x, 1) = "*" Then Target.Value = Replace(x, "*", "000") End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to have checkBox in ToolBar (Icon) ? | Excel Programming | |||
Adding CheckBox Caption to a Listbox | Excel Programming | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
listbox with checkbox or radiobutton groups | Excel Programming | |||
Listbox w/CheckBox Options | Excel Programming |