LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Change row height if cell is blank

Hi. I hope some-one can help.

I have hacked together and modified some code posted for other purposes by
dmcritchie (1 posting) and Tom Ogilvy (2 postings). I thought that I
understood what the code was doing, but it doesnt seem to work €“ any error
is mine, not theirs.

In a column of labels with blank rows between elements I want to set the row
height to 6 if the cell is blank, otherwise leave the row height as default.

The code is given below:

'Macro to set row heights
Sub SetHeights()
AutoCalcOff
Dim cell As Range, Rng As Range
Set Rng = Range("B2:B" & Cells.Rows.Count). _
SpecialCells(xlConstants, xlTextValues)
For Each cell In Rng
If Len(Trim(cell.Value)) = 0 Then
cell.EntireRow.RowHeight = 6
End If
Next cell
AutoCalcOn
End Sub

AutoCalcOff and AutocalcOn are calls to other subroutines.

Regards

Phil Smith

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change cell height of only certain cells (Excel) Church secretary Excel Discussion (Misc queries) 2 May 12th 09 06:08 PM
Change height and width of a single cell R. Johnson Excel Discussion (Misc queries) 3 February 20th 08 07:34 PM
how do I change height of in-cell drop box list to 12 items Prowlin Excel Discussion (Misc queries) 1 January 27th 06 05:59 PM
how to change one cell height not the row Candice Excel Worksheet Functions 2 October 24th 05 07:56 AM
how to change one cell height not the row Candice Excel Worksheet Functions 1 October 24th 05 12:19 AM


All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"