Changing Color and Text of a Cell Using a Form

Kabasauls

New Member
Joined
Jul 12, 2012
Messages
24
Hello,

This is my first post into this forum. I am trying to follow the rules as best as I can. If I miss any, please let me know.

Idea: I set up a range of cells to show a form when they are double clicked. This form gives the user the choice to pick a color and text from a list. When the user clicks "OK" the form closes and changes the cell based on the user's input (i.e. Red, "N/A"). I want only the double cliked cell to change color and text.

Problem: My code runs fine, but I cannot find a way to let the form change the text of the cell. Only the color is changing. I have tried calling the cell out in the code, but I get an error. I cannot find a way to change the text in the cell. I ran out of ideas.

Code:

Code:
Private Sub CommandButton2_Click()
    Dim ColorChosen As String
    Dim WordChosen As String
    ColorChosen = ColorCmb.Value
    WordChosen = LetterCmb.Value
    Sheets("Master Copy").Activate
    
    If ColorChosen = "White" Then
        Selection.Interior.Pattern = xlNone
    ElseIf ColorChosen = "Blue" Then
        Selection.Interior.Color = 16777164
    ElseIf ColorChosen = "Green" Then
        Selection.Interior.Color = 3407718
    ElseIf ColorChosen = "Amber" Then
        Selection.Interior.Color = 65535
    ElseIf ColorChosen = "Red" Then
        Selection.Interior.Color = 255
    ElseIf WordChosen = "NA" Then
        'Selection = "NA"
        cell(1, 1).Value = "String"
    End If


Image:

http://postimage.org/image/g98psnlzl/

Thank you for your time,
Kabasauls
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Thank you for the suggestion. I noticed that my If-Then structure was wrong. Again, thank you for your time.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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