Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to make the color palette seen in the image in VBA. The user will ch

ID: 3832068 • Letter: I

Question

I'm trying to make the color palette seen in the image in VBA. The user will choose from a drop down list of "Constant Color" (Red, Green, or Blue), insert the value, and upon clicking the

"Create Palette" button, outputs something similar to the image.

RGB Color Palette Generator Constant Color Red Create Palette value (0 to 255) 200 RGB Color Palette 7 200, 0,0 200 0, 204 200, 0,51 200, 0,102 200, 0, 153 200 0, 255 200, 51, 102 200, 51, 153 200, 51, 0 200, 51, 51, 200, 102, 0 200, 102, 51 200, 102, 102 200, 102, 255 200, 102, 153 200, 102, 204 10 200, 153, o 200, 153, 51 200, 153,102 200, 153, 153 200, 153,204 200, 153, 255 11 200, 204,0 200, 204, 51 200, 204, 102 200, 204, 153 200, 204, 204 200, 204, 255 200, 255, 153 200, 255, 204 200,255 255 12 200, 255, 0 200, 255, 51 200, 255, 102

Explanation / Answer

Download Sample workbook here : https://drive.google.com/open?id=0B-x1giaUCupZTDZYOFF6UWJRdG8

Steps fo creating drop down list:

Users click the drop-down arrow to display a list of items from U3:U5.To add this drop-down list to a sheet, do the following:

The Code is given Below: If you want to validate range ie 0 to 255 you may do this


Dim r, g, b
Private Sub CommandButton1_Click()
Dim i, j

For i = 6 To 12
For j = 1 To 6
  
If IsEmpty(Cells(i, j)) Then
Cells(i, j).Interior.Color = RGB(r, g, b)
Cells(i, j) = r & "," & g & "," & b
Exit For
End If
Next j
Exit For
Next i
  
  


End Sub


Private Sub TextBox1_Change()

If UCase(Cells(3, 3)) = "RED" Then
r = TextBox1.Value
Else
If UCase(Cells(3, 3)) = "GREEN" Then
g = TextBox1.Value

Else
If UCase(Cells(3, 3)) = "BLUE" Then
b = TextBox1.Value

End If
End If
End If

End Sub