Hello,
How would I be able to get VBA to display borders and cell color from a selected item from my validated data list? I have some code listed here. The first part the data validation list works just fine. I am wanting to add a if statement that runs with the selection of "of Capacity". I want I4 to have a thin border yellow interior and "Capacity" as Value or text. and I5 just to have a thin border. and when "of Reading" is selected, those two cells, I4 and I5 clear.
The second half of my code, doesnt seem to display the borders.
I've tried a couple of things, but cant get it to work. I dont want to use conditional formatting since 98% of everything ran by VBA.
Thank you in advance.
How would I be able to get VBA to display borders and cell color from a selected item from my validated data list? I have some code listed here. The first part the data validation list works just fine. I am wanting to add a if statement that runs with the selection of "of Capacity". I want I4 to have a thin border yellow interior and "Capacity" as Value or text. and I5 just to have a thin border. and when "of Reading" is selected, those two cells, I4 and I5 clear.
The second half of my code, doesnt seem to display the borders.
Code:
With Sheet1.Range("E5").Validation
.Delete
.Add Type:=xlValidateList, Operator:=xlBetween, Formula1:="of Reading," & _
"of Capacity"
End With
Set PlusLabel = Sheet1.Range("I4")
Set Plus = Sheet1.Range("I5")
If Sheet1.Range("E5").Value = "of Capacity" Then
PlusLabel.BorderAround xlContinuous
PlusLabel.HorizontalAlignment = xlCenter
PlusLabel.Interior.Color = Yellow
PlusLabel.Value = "Capacity"
Plus.BorderAround xlContinuous
Plus.HorizontalAlignment = xlCenter
Else: Sheets("Sheet1").Range("I4:I5").Clear
End If
I've tried a couple of things, but cant get it to work. I dont want to use conditional formatting since 98% of everything ran by VBA.
Thank you in advance.