nokout1
09-26-2020, 12:33 PM
I have a workbook where I am using an array to go through certain sheets to check for null ("") cells that have been made by other VBA formulas.
I am creating another loop to delete the null value
I am not knowledgeable enough to create a nesting loop. error I am receiving is "Compile error for without next"
Assistance would be appreciated.
thanks
Sub RemoveBlankCells2()
Dim strLR2 As String
Dim q As Long
Dim Sheetname As String
Dim c As Range
Dim Sh As Variant
Application.EnableEvents = True
Sheets("Sprinkler").Select
Range("A1").Select
For Each Sh In Sheets(Array("Fire", "FA Def", "FA NA", "Sprinkler", "Sprinkler Def", "Sprinkler NA", "Suppression", "Suppression Def", "Suppression NA", "Inspections"))
Sheetname = Sh.Name
Sheets(Sheetname).Select
strLR2 = Worksheets(Sheetname).Range("A" & Rows.Count).End(xlUp).Row
For q = 2 To strLR2
If Trim(Range("I" & q).Value) = "" Then Range("I" & q).ClearContents
Next
End Sub
I am creating another loop to delete the null value
I am not knowledgeable enough to create a nesting loop. error I am receiving is "Compile error for without next"
Assistance would be appreciated.
thanks
Sub RemoveBlankCells2()
Dim strLR2 As String
Dim q As Long
Dim Sheetname As String
Dim c As Range
Dim Sh As Variant
Application.EnableEvents = True
Sheets("Sprinkler").Select
Range("A1").Select
For Each Sh In Sheets(Array("Fire", "FA Def", "FA NA", "Sprinkler", "Sprinkler Def", "Sprinkler NA", "Suppression", "Suppression Def", "Suppression NA", "Inspections"))
Sheetname = Sh.Name
Sheets(Sheetname).Select
strLR2 = Worksheets(Sheetname).Range("A" & Rows.Count).End(xlUp).Row
For q = 2 To strLR2
If Trim(Range("I" & q).Value) = "" Then Range("I" & q).ClearContents
Next
End Sub