Cell = vb green once selected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,936
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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,429
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Maybe:
VBA Code:
If ComboBox1 = "VIN NUMBER" Then
    With Range("A4")
        .Select
        .Interior.Color = vbGreen
    End With
    'rest of code
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
14,052
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
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?
 

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,936
Office Version
  1. 2007
Platform
  1. Windows
Thanks for the replies,didnt spot the gap Mark
 

Watch MrExcel Video

Forum statistics

Threads
1,129,814
Messages
5,638,492
Members
417,028
Latest member
JFCLUK

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
Top