Line Height VBa

Solved
thomadu31 -  
 thomadu31 -
Hello everyone,

I need help with a macro.

I have an Excel file with an indefinite number of rows, some contain data while others are empty.
I would like the height of all the empty rows to be 4.5 and the rows with data to remain at 15.

Hoping to be clear.

Thank you in advance.

Configuration: Windows XP / Chrome 47.0.2526.106

1 réponse

michel_m Posted messages 18903 Registration date   Status Contributeur Last intervention   3 320
 
Hello
based on column A

Option Explicit
'---------------------------------------------------
Sub heightline_if_empty()
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = Columns("A").Find("*", , , , , xlPrevious).Row
If Application.CountIf(Range("A1:A" & LastRow), "") > 0 Then
Range("A1:A" & LastRow).SpecialCells(xlCellTypeBlanks).EntireRow.RowHeight = 4.5
End If
End Sub
'---------------------------------------------------
Sub restore_height()
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = Columns("A").Find("*", , , , , xlPrevious).Row
Range("A1:A" & LastRow).EntireRow.RowHeight = 15
End Sub

--
 Michel
0
thomadu31
 
Hello,

Thank you, it works perfectly.
0