M
Mr. G.
The (row shading) worksheet event code furnished by B.Phillips was exactly
what I've been looking for. However, since I have already have a worksheet
event code running (developed by Julie D) when the user opens up the
spreadsheet, does anyone know if it's possible to still incorporate/link his
code with mine?
(Mr. Phillips)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target.EntireRow
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
End With
.FormatConditions(1).Interior.ColorIndex = 20
End With
(Mine)
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("F12:F15")) Is Nothing Then '1"
On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
For Each c In Range("F13:F15")
If c.Value = "" And c.Offset(0, 46) = 0 Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.EntireRow.Hidden = True
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
For Each c In Range("F12:F15")
If c.Value <> "" Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.Offset(1, 0).EntireRow.Hidden = False
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
ElseIf Not Intersect(Target, Me.Range("F17:F20")) Is Nothing Then '1"
On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
For Each c In Range("F18:F20")
If c.Value = "" And c.Offset(0, 46) = 0 Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.EntireRow.Hidden = True
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
For Each c In Range("F17:F20")
If c.Value <> "" Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.Offset(1, 0).EntireRow.Hidden = False
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End If
End Sub
what I've been looking for. However, since I have already have a worksheet
event code running (developed by Julie D) when the user opens up the
spreadsheet, does anyone know if it's possible to still incorporate/link his
code with mine?
(Mr. Phillips)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target.EntireRow
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
With .FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
End With
.FormatConditions(1).Interior.ColorIndex = 20
End With
(Mine)
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("F12:F15")) Is Nothing Then '1"
On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
For Each c In Range("F13:F15")
If c.Value = "" And c.Offset(0, 46) = 0 Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.EntireRow.Hidden = True
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
For Each c In Range("F12:F15")
If c.Value <> "" Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.Offset(1, 0).EntireRow.Hidden = False
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
ElseIf Not Intersect(Target, Me.Range("F17:F20")) Is Nothing Then '1"
On Error Resume Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
For Each c In Range("F18:F20")
If c.Value = "" And c.Offset(0, 46) = 0 Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.EntireRow.Hidden = True
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
For Each c In Range("F17:F20")
If c.Value <> "" Then
Sheets("EXP RPT").Unprotect ("lindAP")
c.Offset(1, 0).EntireRow.Hidden = False
i = c.Row
Sheets("EXP RPT").Protect ("lindAP")
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End If
End Sub