Discussion Locked

Macro to do text shading

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How is it possible to shade a text with the cursor by using a macro? The shading must be done by holding down the left mouse button and moving the cursor over the text. I cannot find the VBA code to do this.
Thank you.

1 reply

by peyison

Here is a macro that will shade the current selection, but you still have to invoke it manually.

Sub ShadeSelection()
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic End With
End Sub

Paste the above macro into a code module.

Assign a shortcut key to the macro (like CTRL+s):

Select Tools-> Macro-> Macros, select ShadeSelection, and press options.

To use it, select the cells to highlight, then press CTRL+s.

Hope this helps.

This discussion is closed to new replies.