Rows selection

Copper Contributor

I have this code

 

 

Sub unhideAll()
   Dim lr As Integer
   lr = Cells(Rows.Count, 2).End(xlUp).Row
      ThisWorkbook.Worksheets("Kitchen").Rows("2:"&lr).Hidden = False
End Sub

 

 

 

But I want it to look like this

 

 

Sub unhideAll()
   Dim lr As Integer, a As Integer
   lr = Cells(Rows.Count, 2).End(xlUp).Row
   a = 2
      ThisWorkbook.Worksheets("Kitchen").Rows("a:"&lr).Hidden = False

End Sub

 

 

But this doesn't seem to work

 

How do you enter saved integers into a range in excel?

1 Reply

@rad042 

Sub unhideAll()
Dim lr As Integer, a As Integer
lr = Cells(Rows.Count, 2).End(xlUp).Row
a = 2
ThisWorkbook.Worksheets("Kitchen").Rows(a & ":" & lr).Hidden = False

End Sub

 

Is this what you are looking for?