View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lluis Escude Lluis Escude is offline
external usenet poster
 
Posts: 6
Default From cell/combo to combo/cell

Using the Worksheet_Change event handler does not seem convenient as I often
don't need to change the contents of "C5". So in this case the event isn't
triggered. I'm now experimenting with the Worksheet_SelectionChange event
sub, and I'll be playing around for a while. If I make it I'll drop by to
post the final code.

"crazybass2" wrote:

Lluis,

Place the following code in the sheet module. You will need to change the
"ComboBox1/ComboBox2" references in the code to match the name of your combo
boxes. Play around with the 'Activate' and 'DropDown' methods for the
desired effect (ie. delete 'ComboBox1.Activate:' and ': ComboBox2.DropDown'
to see what changes).

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C5")) Is Nothing Then ComboBox1.Activate:
ComboBox1.DropDown
If Not Intersect(Target, Range("C8")) Is Nothing Then ComboBox2.Activate:
ComboBox2.DropDown
End Sub
Private Sub ComboBox1_Change()
Range("C8").Select
End Sub
Private Sub ComboBox2_Change()
Range("C11").Select
End Sub


Mike

"Lluis Escude" wrote:

After I've typed data + return key to a specific cell, say C5, I want the
focus to be automatically transferred to a combobox in the same worksheet.
What code do I need and where -in what event handler- must it be placed?
Then, after I've selected one of the combo items (and maybe -maybe not- hit
the return key as well) I want the focus to be automatically set to some
other cell, such as C8. Same question as above.

The idea is to cycle through a number of cells and comboboxes so that no
cells can be selected/activated that don't require input data.