Change Row height and colour based on value

Andyjk1984

New Member
Joined
May 17, 2019
Messages
11
Hi great people
I have a work stream spreadsheet that I sort by date, the only thing that I'm.struggling with is the height of the rows based of column A containing the number 1, and then colouring the row (A to M) being dark grey

Can anyone help me?
 
Without knowing anything about your data, or the code you are using to do the sort. Not really.
It might be that you don't don't header row, but the code is assuming there is one.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Ok so the date I've got sorted (hopefully) and I've attempted to add a borders to the code you gave me but falling over, I'd want a top and bottom border when the criteria that resized the column (but going to cell FO) and clearing any top bottom border if it doesnt
 
Upvote 0
How about
Code:
Sub Andyjk1984()
   Dim Cl As Range
   
   For Each Cl In Range("A1", Range("A" & Rows.Count).End(xlUp))
      If Cl.Value = 1 Then
         Cl.RowHeight = 33
         Cl.Resize(, 13).Interior.ColorIndex = 16
         With Cl.Resize(, 171)
            .Borders(xlEdgeTop).Weight = xlThin
            .Borders(xlEdgeBottom).Weight = xlThin
         End With
      Else
         Cl.RowHeight = 20
         Cl.Resize(, 171).Borders(xlEdgeBottom).LineStyle = xlNone
      End If
   Next Cl
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,670
Members
452,993
Latest member
FDARYABEE

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