change colour of cell base on selected value in combobox userform

eltonpiko

New Member
Joined
Jan 16, 2014
Messages
3
hi i have a userform to enter data into selected cell is has several combo box and text box . i need that when i submit my data base on a specific combo box the colour of the selected cell will change accordingly.

cell colour should change base on selected value of (clienttype)

my code looks like this

Code:
Private Sub age_DropButt*******()


age.AddItem "1"
age.AddItem "2"
age.AddItem "3"
age.AddItem "4"
age.AddItem "5"
age.AddItem "6"
age.AddItem "7"
age.AddItem "8"
age.AddItem "9"
age.AddItem "10"


End Sub






Private Sub clienttype_DropButt*******()


clienttype.AddItem "Educational"
clienttype.AddItem "Tour Operator"
clienttype.AddItem "Family Trip"
clienttype.AddItem "DMC'S"
clienttype.AddItem "Honeymooners"


End Sub


Private Sub dmc_DropButt*******()


dmc.AddItem "Creol Travel"
dmc.AddItem "Masons"
dmc.AddItem "Select"
dmc.AddItem "Elite"
dmc.AddItem "Cheung Kong Tavel"
dmc.AddItem "none"


End Sub




Private Sub paymenttype_DropButt*******()


paymenttype.AddItem "Credit Card"
paymenttype.AddItem "Debit Card"
paymenttype.AddItem "Bank Transfer"
paymenttype.AddItem "Cash"
paymenttype.AddItem "Cheque"


End Sub






Private Sub submit_Click()
ActiveCell.Value = fullname.Value & " , arrival Date: " & arrival.Value & " , Departure Date: " & departure.Value & " , children age: " & age.Value & " , Client type: " & clienttype.Value & " , DMC: " & dmc.Value & " , Payment Type: " & paymenttype.Value & " , Payment Facility: " & paymentfac


Unload clientform
End Sub


Private Sub UserForm_Click()


End Sub


hope someone can help me out
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Change the numbers to a number representing the colour you want.

Code:
Private Sub submit_Click()
    ActiveCell.Value = FullName.Value & " , arrival Date: " & arrival.Value & _
                       " , Departure Date: " & departure.Value & " , children age: " & age.Value & _
                       " , Client type: " & clienttype.Value & " , DMC: " & dmc.Value & _
                       " , Payment Type: " & paymenttype.Value & " , Payment Facility: " & _
                       paymentfac
    With ActiveCell.Interior
        Select Case clienttype.Value


            Case "Educational"
                .Color = 1
            Case "Tour Operator"
                .Color = 2
            Case "Family Trip"
                .Color = 3
            Case "DMC'S"
                .Color = 4
            Case "Honeymooners"
                .Color = 5
        End Select
    End With
    Unload clientform
End Sub
 
Upvote 0
I notice that even if i select 3 cells only one is being coloured. Is there a way that if user want that data to occupy 2 or more cell they all get highlighted on submit?
thanks
 
Upvote 0

Forum statistics

Threads
1,214,894
Messages
6,122,124
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top