VBA Help: Automatically resize all rows containing specific calculated value in a column


New Member
Nov 17, 2018
Hello MrExcel community :)

I am searching for a solution to resize all of the rows in a worksheet based on the calculated value in column H. I have used column H a conditional formatting helper. In this case, the only two values in column H are "None" and "Color". These values are being returned from an if statement that I wrote. Anyway, I have conditionally formatted the sheet to color fill all rows containing "Color" in column H but I also want to resize these to basically create a thick border as conditional formatting only has thin boarders.

If someone could help me write a sub procedure to find all rows with "Color" in column H and resize them I would be extremely grateful as I have not found an easy solution at the moment. Also, as I add more data, the amount of "Color" and "None" values will change as well.

Thank you!


MrExcel MVP, Moderator
Jun 12, 2014
Office Version
Hi & welcome to MrExcel.
How about
Sub ResizeRws()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Replace "Color", True, xlWhole, , False, , False, False
      .SpecialCells(xlConstants, xlLogical).EntireRow.RowHeight = 5
      .Replace True, "Color", xlWhole, , False, , False, False
   End With
End Sub

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...