Is there there any code in Excel 2010 VBA that I can use to hide row n (e.g. row 200) to the maximum row?
Btw the name of the sheet in particular is
Updated comment: To be clear I interpreted this question as hiding from row 200 to the used row with data (if that last used row exceeded 200)
Something like this
code
Sub HideEm()
Dim rng1 As Range
Set rng1 = ActiveSheet.Cells.Find("*", [a1], xlValues, , , xlPrevious)
If Not rng1 Is Nothing Then
If rng1.Row > 200 Then Rows("200:" & rng1.Row).Hidden = True
End If
End Sub
to work on a specific sheet
Sub HideEm()
Dim ws As Worksheet
Dim rng1 As Range
Set ws = Sheets("main")
Set rng1 = ws.Cells.Find("*", ws.[a1], xlValues, , , xlPrevious)
If Not rng1 Is Nothing Then
If rng1.Row > 200 Then ws.Rows("200:" & rng1.Row).Hidden = True
End If
End Sub
Normally I would tell you to try and downvote your question but hey I'm lazy this morning so I'll just give you the answer for which you haven't worked for.
Rows(200, ActiveSheet.Rows.Count).Hidden = true