Hide Row

leomail

New Member
Joined
May 18, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Ik weet niet of het mogelijk is maar ik heb een rappoort waarin blanco regels staan en deze wil ik verbergen, maar wil 1 rij onder de laatste ingevulde rij blanco laten.
Met de onderstaande formule kom ik een heel eind maar ik vroeg me af of er een eenvoudige manier is.

If Range("A14").Value = "" Then
Rows("15:49").Hidden = True
End If
If Range("A14").Value > 0 Then
Rows("15").Hidden = False
End If
If Range("A15").Value = "" Then
Rows("16:49").Hidden = True
End If
If Range("A15").Value > 0 Then
Rows("16").Hidden = False
End If
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi - Welcome to MrExcel. ( I deciphered your need with the help of translator - Dutch-language)

This can be easily achieved with the help of Goto Special options which is available as handy in excel.

Select your data - Press F5 - Special - select "Blanks" option - then using delete option you can delete the rows.
 
Upvote 0
I don't know if it's possible but I have a report with blank lines and I want to hide it, but want to leave 1 row below the last row blank. The formula below goes a long way but I was wondering if there is an easy way in VBA
 
Upvote 0
I have this formula but want to add only 1 row and not a series of rows.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
For Each c In Range("A14:A50").Cells
If c.Value >= 1 Then
With ActiveCell.EntireRow
.Copy
.Offset(1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
On Error Resume Next
.Offset(1).SpecialCells(xlCellTypeConstants).Value = ""
Application.CutCopyMode = False
On Error GoTo 0
End With
End If
Next c
End Sub
 
Upvote 0
I found a code that works for me.
Sub InsertRow()
Range("A14").Select
With ActiveCell.EntireRow
.Copy
.Offset(1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
On Error Resume Next
.Offset(1).SpecialCells(xlCellTypeConstants).Value = ""
Application.CutCopyMode = False
On Error GoTo 0
End With
Rows(15).Hidden = False
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top