View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Nadeem Nadeem is offline
external usenet poster
 
Posts: 1
Default How to stop printing the VB Code Result

I am not a programmer guys, I am using the following code in my Excel worksheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Cells.FormatConditions.Delete
With Target.EntireRow
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Borders(xlBottom).LineStyle = xlContinuous
End With

Cells.Interior.ColorIndex = xlColorIndexNone
Target.EntireRow.Interior.ColorIndex = 36

Dim MyRng As Range
Set MyRng = Target '.EntireRow
Application.EnableEvents = False
On Error GoTo end1
'Application.Cells.Font.Size = 10
With MyRng
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ROW()=ROW(INDIRECT(CELL(""address"")))"
With .FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 1
End With
'.Font.Size = 20
.FormatConditions(1).Interior.ColorIndex = 24
End With
end1:
Application.EnableEvents = True

End Sub

but when I print my worksheet the result which is highlighted row prints
too. I dont want it to print. Can any one please edit this code and stop the
reult from printing.