View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Selected Cell Problem

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
Application.ScreenUpdating = False
Set OldCell = Target
With OldCell
.Interior.ColorIndex = 8
.Font.Size = 20
.Font.Name = "Arial"
End With
Application.ScreenUpdating = True
End If
End Sub


Gord Dibben MS Excel MVP

On Sat, 12 Jul 2008 08:33:42 -0700 (PDT), Shazi wrote:


Dear All,

I am using the below worksheet event to increase the Selected Font
Size and to change the Interior Color (background color).

This procedure is working fine, but there is a small problem, its
removing all Filled Color area from (background area) and making Font
10 in all sheet.

I want a procedure to change the Font Size and Back color only in the
selected cell. rest of the sheet will remain same formatting.

If its possible pls send me reply.

My procedure is given below.

'++++++++++++++++++++++++++++++++++++++++++++++++ +++++
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.ScreenUpdating = False

Cells.Interior.ColorIndex = xlNone
Cells.Font.Size = 10
Target.Interior.ColorIndex = 8

With Selection.Font
.Name = "Arial"
.Size = 20
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Application.ScreenUpdating = True

End Sub

'++++++++++++++++++++++++++++++++++++++++++++

Thanks and regards.

Shahzad Zafar
Madinah