View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Enlarge font & change color when cell is selected

You need the for loop in the code below if you are copying and pasting morre
than one cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For Each cell In Target
If cell.Columns <= 10 Then
cell.Font.Size = 15
cell.Interior.ColorIndex = 5
Else
cell.Font.Size = 10
cell.Interior.ColorIndex = xlNone
End If
Next cell
End Sub


" wrote:

I need to make a range of cells increase their font size when
selected. I found the following macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Columns(1).Font.Size = 10
If Target.Column = 1 Then
Target.Font.Size = 15
End If
End Sub

This works great for a single column, but I need 10 columns. Also, if
I wanted a color when the cell is selected, how would these be
written? Thank you for your help.