Working with Worksheet_SelectionChange
I have following code in worksheet selection function.
Problem is that when i select Ctrl + A i.e. select all sheet and click
on any cell then code executed for all the selected cell and format of
sheet changes to the format of active cell.
what i want is format should not change if all sheet is selected it
should change only when single cell is selected and that cell should be
from range "C7:AG151"
What should i do with this, please help me.
Private Sub Worksheet_SelectionChange(ByVal target As Range)
If Not Application.Intersect(target, Range("C7:AG151")) Is Nothing Then
If IsEmpty(ActiveCell.Value) = True Or ActiveCell.Value = "P(1st)"
Call Present(target)
end if
end sub
Sub Present(target)
target.Activate
With Selection.Interior
Call ClearPass
target.Font.ColorIndex = 3
target.Font.Bold = True
target.HorizontalAlignment = xlCenter
.ColorIndex = 0
Call SetPass
' .Pattern = xlSolid
End With
End Sub
With Regards,
Swapnil
|