Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
Use the Change Event of the ComboBox and the Select Case Statement as in the example below Private Sub ComboBox1_Change() Dim SelectVal SelectVal = ComboBox1.Value Select Case SelectVal Case 1 Worksheets("Sheet2").Range("B45:B52").Copy Destination:=Worksheets("Sheet2").Range("B58:B65") Range("A1").Value = "Number 1 selected" Case 2 Worksheets("Sheet2").Range("C45:C52").Copy Destination:=Worksheets("Sheet2").Range("B58:B65") Range("A1").Value = "Number two chosen" Case Else Range("A1").Value = "Numbers 1 and 2 not selected" End Select End Sub Best of luck Peter Scott -----Original Message----- Hello! I am using excel and combobox to give alternatives for user. How to programme following command in VBA: If comboboxselection = 1 Then Copy from 'sheet2'!B45:B52 & paste to 'sheet2'!B58:B65 If comboboxselection = 2 Then Copy from 'sheet2'!C45:B52 & paste to 'sheet2'!B58:B65 If comboboxselection = 3 Then Copy from 'sheet'!D45:D52 & paste to 'sheet2'!B52:B65 .. .. .. repeated sufficient times... Hannu Rantala . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula for Cases=144 * # of Cases + Pieces | Excel Discussion (Misc queries) | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
repetition cases | Excel Discussion (Misc queries) | |||
two cases for countif | Excel Worksheet Functions | |||
Matching 2 cases at once. | Excel Discussion (Misc queries) |