Coloring a range, passing the mouse

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
Hi.
I wonder if it is possible to color the background of nonblank cells in a range, passing the mouse (maybe MouseMove Event)
 

Some videos you may like

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

jamtay317

Well-known Member
Joined
Mar 6, 2013
Messages
769
1. select the range
2. push alt, o , d
3. use formula
4. copy and past this =not(a1="") this is assuming that your range starts in a1 if not adjust accordingly
 

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
not conditional formatting!!


Hovering the mouse over the range that has data cells that range will be colored
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047

ADVERTISEMENT

try below code in Worksheet Module ( Right Click on Sheet Tab Then View Code And paste below code close)
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
For Each cell In Selection
If cell.Value <> "" Then cell.Interior.ColorIndex = 6
Next
End Sub
 

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
Thanks, but not that.


In your code I have to do click in the cell.


What I want is: when you move the mouse over the cell
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047

ADVERTISEMENT

Thanks, but not that.


In your code I have to do click in the cell.



What I want is: when you move the mouse over the cell

Without click no cell how can you select range ?
 

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
I do not want to select anything, I want to move the mouse (pass mouser), the cell
 

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
while someone does not respond, then how do I use your code differently.


one that was clicked, the range will be colored.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,414
Messages
5,596,001
Members
414,037
Latest member
Roamingsmile

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