Combobox value populate cell selection

A

AA Arens

I am looking for button code to have a selected cell range merged and
populated with value chosen from combobox. This value is centered in
the merged cell selection.

The cells range is defined manually with mouse.


Bart
 
G

Gord Dibben

Have a look at this event code which you can refine.

No error-checking for data in the selected range...........assumes the
mergerange is empty when selected.

Runs when a value is selected from Combobox1

Private Sub ComboBox1_Change()
Set srng = Application.InputBox(prompt:= _
"Select A Range", Type:=8)
With srng
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.MergeCells = True
.Value = ComboBox1.Value
End With
End Sub


Gord Dibben MS Excel MVP
 
A

AA Arens

Have a look at this event code which you can refine.

No error-checking for data in the selected range...........assumes the
mergerange is empty when selected.

Runs when a value is selected from Combobox1

Private Sub ComboBox1_Change()
Set srng = Application.InputBox(prompt:= _
            "Select A Range", Type:=8)
With srng
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .MergeCells = True
        .Value = ComboBox1.Value
    End With
End Sub

Gord Dibben     MS Excel MVP

Thanks Gord. It going in the right direction.

What I finally looking for is the user has to set two combo values and
one toggle button value (Y/N) and that this string (value A, value B
and Y/N) is populated in a cell range, merged and centered.

It is possible to set the mouse selection without the "Set a range"
inputbox? So the user select the cells and a command only performs the
population process based on the chosen values.

Bart
 
A

AA Arens

Thanks Gord. It going in the right direction.

What I finally looking for is the user has to set two combo values and
one toggle button value (Y/N) and that this string (value A, value B
and Y/N) is populated in a cell range, merged and centered.

It is possible to set the mouse selection without the "Set a range"
inputbox? So the user select the cells and a command only performs the
population process based on the chosen values.

Bart

Anybody able to assist me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top