View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Shazi Shazi is offline
external usenet poster
 
Posts: 74
Default Selected Cell Problem

On Jul 12, 7:12*pm, "Rick Rothstein \(MVP - VB\)"
wrote:
I think this code will do what you are looking for...

Dim LastFontSize As Long
Dim LastColorIndex As Long
Dim LastVisitedCell As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
* Application.ScreenUpdating = False
* If Len(LastVisitedCell) 0 Then
* * Range(LastVisitedCell).Interior.ColorIndex = LastColorIndex
* * Range(LastVisitedCell).Font.Size = LastFontSize
* End If
* LastColorIndex = Target.Interior.ColorIndex
* LastFontSize = Target.Font.Size
* 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
* LastVisitedCell = Target.Address
End Sub

Rick

"Shazi" wrote in message

...





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- Hide quoted text -


- Show quoted text -


Dear All,

Thank you very much for your continious support specially to Mr. Rick.
Now I got the solution of my problem exactly what I want.

Once again thank you for taking time for me to solve my problem.

by the way Mr. Rick I am using your procedure in my project.

with best regards.

Syed Shahzad Zafar
Madinah