Cell = vb green once selected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,199
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Ive been trying without luck for the last hour to change the cells interior colour to vb green once it’s been selected from the partial code shown below.

The full code allows me to select from ComboBox1 & the selection is then A-G row 4
My cells are all yellow but I would like the selected cell to become vb green.

After the .Select below I’ve tried,
Interior.color = vb green

ColorIndex = vb green

ActiveCell.Color = vb green

I don’t click the cell because the code selects the cell so I can apply it to the worksheet change event.

None of the above work, can you put my mind at rest please.
Have a nice day.


VBA Code:
If ComboBox1 = "VIN NUMBER" Then
Range("A4").Select

ElseIf ComboBox1 = "VEHICLE" Then
Range("B4").Select

ElseIf ComboBox1 = "CUSTOMER" Then
Range("C4").Select
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Maybe:
VBA Code:
If ComboBox1 = "VIN NUMBER" Then
    With Range("A4")
        .Select
        .Interior.Color = vbGreen
    End With
    'rest of code
 
Upvote 0
There is no gap between the vb and green
VBA Code:
Range("A4").Select
Selection.Interior.Color = vbGreen

Although I feel I must ask why you need to select the cell?
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,316
Members
448,564
Latest member
ED38

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