Hi group. Could someone help me with shortening the below Macro. Basically I want to hide rows that start with the number 3 and goes to 18 or higher, and you can see below how I did it the long way.
Is there a way I could have an input box popup that would ask me the # of rows that I want hidden? Thanks for your help. Also, could someone explain Loop to me and an example of how it works. Maybe I could use the loop function here? Sub Hide_Rows() Dim i As Integer For i = 3 To 1000 Sheets("Total Mo Plus").Select If ActiveSheet.Range("a" & i).Value = "3" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "4" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "5" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "6" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "7" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "8" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "9" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "10" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "11" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "12" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "13" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "14" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "15" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "16" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "17" Then Rows(i & ":" & i).EntireRow.Hidden = True ElseIf ActiveSheet.Range("a" & i).Value = "18" Then Rows(i & ":" & i).EntireRow.Hidden = True End If Next i End Sub --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---