If column A in a table is blank then row height 9.0

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,340
Office Version
  1. 365
Platform
  1. Windows
I have code (that someone was kind enough to help with) that inserts a blank row in my table based on conditions

Code:
Sheet4.Select

 Dim col As String
    Dim i As Long
    Dim startRow As Long
    Dim lastRow As Long
    
    col = "F"
    startRow = 4
    lastRow = Cells(Rows.Count, col).End(xlUp).Row
    
    With ActiveSheet
        For i = lastRow To startRow Step -1
            If Range("F" & i).Value = "1" Then
                .Cells(i, col).EntireRow.Insert shift:=xlDown
            End If
        Next i
    End With


What I would like to do is to go back through the table and where there is a blank row change its row height to 9.0

Thanks for the help!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try:
VBA Code:
Sub ChangeRowHeight()
    Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.RowHeight = 9
End Sub
 
Upvote 0
Solution
Thanks.

I was trying to figure it out and I tried:

Code:
Sub AddRows ()

Sheet4.Select

    Dim col As String
    Dim col2 As String
    Dim i As Long
    Dim startRow As Long
    Dim lastRow As Long
    
    col = "F"
    col2 = "A"
    startRow = 4

        lastRow = Cells(Rows.Count, col).End(xlUp).Row
    
    With ActiveSheet
         
        For i = lastRow To startRow Step -1
        
            If Range("F" & i).Value = "1" Then
                .Cells(i, col).EntireRow.Insert shift:=xlDown
            End If
            
            If Range("A" & i).Value = "" Then
                .Cells(i, col).EntireRow.RowHeight = 9
            End If
            
        Next i
        
    End With

Here's what I did. I am actually learning a lot form helpful people on this site!

I added:
If Range("A" & i).Value = "" Then
.Cells(i, col).EntireRow.RowHeight = 9
End If

And it seems to work. I am having another issue, but that's a separate post which I will submit now.

But I really appreciate the help Mumps
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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