How to edit row height with conditional formatting?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to edit row height with conditional formatting. I have a query behind
my spreadsheet and there are 3 types of products it returns (X, Y, Z). When
it returns a Z product (product is a column heading), I want the row height
to be much smaller than if it returns a X or Y product. Does anyone know how
this can be done? Thanks.
 
Cannot be done without code

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
not with Conditional Formatting. It could probably be done with a VBA
event macro.
 
Is this code complicated or is it a simple sub? I've used VB a little bit in
the past but never with Excel so I don't really know where to begin. Can you
give me a little help with the code if you have the time?
 
You would need to use Worksheet_Change() event code. The code below checks
to see if the change is in column A. If the entry in columnA is a 'Z'. (This
can be changed to anything) then it adjusts the row height to 5. If it is
anything else it remains untouched. Just a starter bit of code. Here's how
you implement it.
(http://www.nickhodge.co.uk/vba/vbaimplement.htm#eventcode)

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Columns("A:A"), Target) Is Nothing Then
With Application
.EnableEvents = False
If UCase(Target.Value) = "Z" Then
Target.RowHeight = 5
End If
.EnableEvents = True
End With
End If
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top