VBA? Activecell formatting

  • Thread starter Thread starter click4mrh
  • Start date Start date
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
 
Just a single line of code will do it:

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

HTH,
Nikos
 
one way:

Public Sub ThreeCellsRed()
ActiveCell.Resize(1,3).Interior.ColorIndex = 3
End Sub
 
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
 
Thank you all, sure wish I had the time to learn vba, tg for all you
expertise. MR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top