I have a worksheet containing itemized inventories of rooms throughout our campus with condition ratings given to each item based upon damage and so on. I'm trying to create a macro to automate the process of scanning all of these worksheets for condition values under a 3. All of my worksheets are formatted the same with the same column headings only different row counts.
My question is this, I am fairly new to VBA coding in excel, How can I have it find values below 3 in a specific column on each worksheet and copy them to a predesignated output worksheet? I have found and modified the following code to match what I'm doing so far, but I don't know how to modify it to continue through the additional sheets as this only applies to one sheet so far?
My question is this, I am fairly new to VBA coding in excel, How can I have it find values below 3 in a specific column on each worksheet and copy them to a predesignated output worksheet? I have found and modified the following code to match what I'm doing so far, but I don't know how to modify it to continue through the additional sheets as this only applies to one sheet so far?
Code:
Sub MoveRowBasedOnCellValue()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Hvidsten Hall of Music - MUS").UsedRange.Rows.count
J = Worksheets("Low Condition Report").UsedRange.Rows.count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Low Condition Report").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Hvidsten Hall of Music - MUS").Range("Q1:Q" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.count
If CStr(xRg(K).Value) = "Yes" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Low Condition Report").Range("A" & J + 1)
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub