First of all I would share my data but it contains personal information about patients so I will abstain. I will preface through: in my role I receive many reports containing patient data and there is a lot of manual leg work to go and tell where the fallouts are. In this specific spreadsheet we are looking at the times we performed neuro assessments on patients post-stroke. When too much time has elapsed between stroke assessments I am wanting to do guided follow up with individuals to coach to the correct way. What I want is for a whole row to highlight red with red text if more than a given amount of time has elapsed. This will instantly tell me the fallouts and will help identify barriers to care or improve quality of care through associate coaching.
Here is my current macro:
Option Explicit
Sub StrokeSheetFormatting()
Dim lastrow As Long
lastow = shFormatting.Cells(Rows.Count, 3).End.Row
With shFormatting.Range("A14:S21" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:30-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
Next
With shFormatting.Range("A24:S33" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:45-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
Next
With shFormatting.Range("A36:S49" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:30-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
End Sub
The problem I get is it tells me that "shFormatting" is not defined. I am newer to VBA and have done some more basic macros that help with associate scheduling. Otherwise my experience is limited to watching(participating) in so VBA courses from YouTube while fumbling through my scheduling macros before.
Here is my current macro:
Option Explicit
Sub StrokeSheetFormatting()
Dim lastrow As Long
lastow = shFormatting.Cells(Rows.Count, 3).End.Row
With shFormatting.Range("A14:S21" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:30-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
Next
With shFormatting.Range("A24:S33" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:45-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
Next
With shFormatting.Range("A36:S49" & lastrow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula:="=($I15-$I14>(00:30-00:15)"
.FormatConditions(1).Interior.Color = RGB(255, 199, 206)
.FormatConditions(1).Font.Color = RGB(156, 0, 6)
End With
End Sub
The problem I get is it tells me that "shFormatting" is not defined. I am newer to VBA and have done some more basic macros that help with associate scheduling. Otherwise my experience is limited to watching(participating) in so VBA courses from YouTube while fumbling through my scheduling macros before.