VBA? Activecell formatting

C

click4mrh

Looking for a simple VBA macro for formatting three cells starting wit
the active cell.

Want to use ctrl-d to select activecell, then next two cells to th
right and then fill all three cells with color red
 
N

Nikos Yannacopoulos

Just a single line of code will do it:

Range(ActiveCell, ActiveCell.Offset(0, 2)).Interior.Color = vbRed

HTH,
Nikos
 
J

JE McGimpsey

one way:

Public Sub ThreeCellsRed()
ActiveCell.Resize(1,3).Interior.ColorIndex = 3
End Sub
 
S

ste mac

Hi click4mrh
Want to use ctrl-d to select activecell, then next two cells to the
right and then fill all three cells with color red.

Perhaps not the most elegant.. but it works for me..

Sub colour3red()
ActiveCell.Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ActiveCell.Offset(0, 1).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ActiveCell.Offset(0, 1).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With


Put this in a module and just assign what shortcut keys you want...

hope this helps

seeya ste
 
C

click4mrh

Thank you all, sure wish I had the time to learn vba, tg for all you
expertise. MR
 
Top