Hello all!
I've looked through pages and pages of searches here and across the web, and I'm back with no luck. Hoping someone will see something that I should be seeing.
I am trying to perform nested loops and the outer loop (worksheets) isn't looping from ws to ws.
When the macro is run, the nested part (cell in range) performs great within the active worksheet. But I want to start at the first worksheet and apply the "For Each cell..." within each worksheet across the whole workbook.
Any thought, I'm all ears! And thanks in advance!
Looks like:
I've looked through pages and pages of searches here and across the web, and I'm back with no luck. Hoping someone will see something that I should be seeing.
I am trying to perform nested loops and the outer loop (worksheets) isn't looping from ws to ws.
When the macro is run, the nested part (cell in range) performs great within the active worksheet. But I want to start at the first worksheet and apply the "For Each cell..." within each worksheet across the whole workbook.
Any thought, I'm all ears! And thanks in advance!
Looks like:
VBA Code:
Sub AnalysisStep3()
Dim ws As Worksheet
Dim rnumrange As Range
Set rnumrange = Range("I2:I27,I32:I65")
For Each ws In Worksheets
For Each cell In rnumrange
If cell.Value >= 5 And cell.Value <= 32 Then
cell.Offset(0, 8).Value = 1
ElseIf cell.Value >= "0" And cell.Value < 5 Then
cell.Offset(0, 8).Value = 2
ElseIf cell.Value <= 40 And cell.Value > 32 Then
cell.Offset(0, 8).Value = 2
ElseIf cell.Value = "Undetermined" Then
cell.Offset(0, 8).Value = 3
Else: cell.Offset(0, 8).Value = 4
End If
Next cell
Next ws
End Sub
Last edited: