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)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

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
Office Version
  1. 365
Platform
  1. Windows

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
Office Version
  1. 365
Platform
  1. Windows

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
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
Office Version
  1. 365
Platform
  1. Windows
sorry this beyond my ability some other can help may be thanks
 

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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,669
Messages
5,838,685
Members
430,563
Latest member
Raeyven

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