Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Automatically Change Row Height Based on Cell Contents?

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Automatically Change Row Height Based on Cell Contents?

Try Columns("B") .AutoFit

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Automatically Change Row Height Based on Cell Contents?

How will that change the row height?

"Office_Novice" wrote:

Try Columns("B") .AutoFit

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Automatically Change Row Height Based on Cell Contents?

.AutoFit Will adjust the cells in the defined range to fit the contents of
the cells in that range

"samcham" wrote:

How will that change the row height?

"Office_Novice" wrote:

Try Columns("B") .AutoFit

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Automatically Change Row Height Based on Cell Contents?

This should do what you want. Test it on a copy before permanent installation.

Sub colBrwHgt()
Dim lastRow As Long, wks As Worksheet
lastRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Set wks = ActiveSheet
For Each c In wks.Range("B2:B" & lastRow)
If c.Value Like "*Total*" Then
c.EntireRow.RowHeight = 25
End If
Next
End Sub

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Automatically Change Row Height Based on Cell Contents?

Thanks, but I'm not trying to autofit to the contents. I'm trying to
increase the row height for rows that contain the subtotals. The height of
those rows is already autofit to the contents, but I want it to be greater.
For example, the autofit height is 12, but I want it to be 25 if there's a
subtotal on that line.

Sam.

"Office_Novice" wrote:

.AutoFit Will adjust the cells in the defined range to fit the contents of
the cells in that range

"samcham" wrote:

How will that change the row height?

"Office_Novice" wrote:

Try Columns("B") .AutoFit

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Automatically Change Row Height Based on Cell Contents?

PERFECT! Thank you very much!

Sam.

"JLGWhiz" wrote:

This should do what you want. Test it on a copy before permanent installation.

Sub colBrwHgt()
Dim lastRow As Long, wks As Worksheet
lastRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Set wks = ActiveSheet
For Each c In wks.Range("B2:B" & lastRow)
If c.Value Like "*Total*" Then
c.EntireRow.RowHeight = 25
End If
Next
End Sub

"samcham" wrote:

Is there a way to change the row height based on the contents of a cell?

Here's what I've done:

1. I have a worksheet with about 6,000 or so lines, containing data for
over 100 departments.

2. I've created Subtotals, and used Ron DeBruin's code to create separate
worksheets for each department.

3. The subtotals came over to the individual worksheets just fine. Now I
want to change the row height of the rows that contain the subtotals to 25,
so the worksheets are easier to read. Each of the subtotal rows has the word
"Total" included in the entry in column B.

Is there a way to automate this task?

Thanks,

Sam.

Reply
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
row height increase automatically to fit contents of merged cells JB Excel Discussion (Misc queries) 1 May 22nd 07 07:37 PM
Change contents of a cell based on cell contents. Mahnian Excel Programming 3 May 4th 07 10:49 PM
Change row height based on content of merged cell Steve[_89_] Excel Programming 2 May 1st 07 02:32 PM
how to change the raw height automatically based on the content si ASQ Excel Discussion (Misc queries) 1 July 17th 05 10:04 AM
Can I automatically start a macro if the contents of a particular cell change markshowell Excel Programming 1 March 2nd 04 07:29 PM


All times are GMT +1. The time now is 01:51 PM.

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

About Us

"It's about Microsoft Excel"