Line Height VBa
Solved
thomadu31
-
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
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
Hello
based on column A
--
Michel
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
Thank you, it works perfectly.