Hide Rows From a Row to Last usedCell.Row

  • Thread starter Thread starter helmekki
  • Start date Start date
H

helmekki

Hi there
i want to hide from lRow Down to the last used Cell.

I tried to modify this code , but could not make it work.


Code:
--------------------
Sub Macro2()
Dim lRow As Long

lRow = Selection.Row
If lRow <= 5 Then Exit Sub

Rows("lRow:" & Selection.End(xlDown)).EntireRow.Hidden = True

End Sub
 
Just a minor change in your code should do it...
==================
Dim lRow As Long

lRow = Selection.Row
If lRow <= 5 Then Exit Sub

Range(Rows(lRow), Rows(Selection.End(xlDown).Row)).EntireRow.Hidden = True
===========================================================
you could also use:

Range(Rows(Selection.Row), Rows(Selection.End(xlDown).Row)).EntireRow.Hidden
= True

(works in Excel 2000)
 
Good evening Helmekki

Slight departure from your code, but it's neat and seems to work OK.
It actually hides the rows from the currently active cell row right u
to the last row containing information.

Sub Test()
lastrow = ActiveSheet.UsedRange.Rows.Count + 1
nowrow = ActiveCell.Row + 1
For f = nowrow To lastrow
Rows(f).Select
Selection.EntireRow.Hidden = True
Next f
End Sub

Is that any good to you?

HTH

Dominic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top