Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Bolding problem on Subtotals

Hi All...........

I have this macro, put together by kind people in this group..........

Sub AddRowSubTotalsBoth()
'Adds blank rows to the Sub-totaled sheet for easier reading
'Also changes font on the first 30 columns from the left to BOLD
Dim lastrow As Long
Dim r As Long

lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is number
'of columns from "A" that the macro is supposed to BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert

End If
Next
End Sub

I use it to add blank rows to separate and make bold the Subtotals of
reports (obtained using the Data Subtotals feature) to make the subtotal
titles and values easier to read. There are two different reports I use
this macro with. One has the word total in a string in column "C" and the
other has it in column "H". It all works fine except for the bottommost
subtotal and the Grand Total values in both reports.......these two values,
both in Column "X" are left normal font, even tho their titles in column "C"
or "H" respectively are bolded. The subtotals of the upper groups, also in
column "X" DO get bolded........just these two don't.

Also, there is no insertion of a blank row between the bottommost Subtotal
and the Grand total..........but this is not as serious as the two values
not being bold.


Any help to insure these last two get changed to Bold Font ( and maybe the
last blank row insertion), would be appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Bolding problem on Subtotals

You use column A to find the bottom of your data, but there are no entries
in A for the two problematic line. Solution would be to change A to X in
lastrow = Range("A" & Rows.Count).End(xlUp).Row

would be

lastrow = Range("X" & Rows.Count).End(xlUp).Row

This should solve you insert row problem as well

Otherwise, leave the macro as written.


Sub AddRowSubTotalsBoth()
'Adds blank rows to the Sub-totaled sheet for easier reading
'Also changes font on the first 30 columns from the left to BOLD
Dim lastrow As Long
Dim r As Long

lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is number
'of columns from "A" that the macro is supposed to BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert

End If
Next
End Sub

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Hi All...........

I have this macro, put together by kind people in this group..........

Sub AddRowSubTotalsBoth()
'Adds blank rows to the Sub-totaled sheet for easier reading
'Also changes font on the first 30 columns from the left to BOLD
Dim lastrow As Long
Dim r As Long

lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is

number
'of columns from "A" that the macro is supposed to BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert

End If
Next
End Sub

I use it to add blank rows to separate and make bold the Subtotals of
reports (obtained using the Data Subtotals feature) to make the subtotal
titles and values easier to read. There are two different reports I use
this macro with. One has the word total in a string in column "C" and the
other has it in column "H". It all works fine except for the bottommost
subtotal and the Grand Total values in both reports.......these two

values,
both in Column "X" are left normal font, even tho their titles in column

"C"
or "H" respectively are bolded. The subtotals of the upper groups, also

in
column "X" DO get bolded........just these two don't.

Also, there is no insertion of a blank row between the bottommost Subtotal
and the Grand total..........but this is not as serious as the two values
not being bold.


Any help to insure these last two get changed to Bold Font ( and maybe the
last blank row insertion), would be appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3




  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Bolding problem on Subtotals

You are AMAZING Tom!...........your fix worked perfectly for both my
problems.

Thank you very kindly.

Vaya con Dios,
Chuck, CABGx3


"Tom Ogilvy" wrote in message
...
You use column A to find the bottom of your data, but there are no entries
in A for the two problematic line. Solution would be to change A to X in
lastrow = Range("A" & Rows.Count).End(xlUp).Row

would be

lastrow = Range("X" & Rows.Count).End(xlUp).Row

This should solve you insert row problem as well

Otherwise, leave the macro as written.


Sub AddRowSubTotalsBoth()
'Adds blank rows to the Sub-totaled sheet for easier reading
'Also changes font on the first 30 columns from the left to BOLD
Dim lastrow As Long
Dim r As Long

lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is

number
'of columns from "A" that the macro is supposed to BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert

End If
Next
End Sub

--
Regards,
Tom Ogilvy

"CLR" wrote in message
...
Hi All...........

I have this macro, put together by kind people in this group..........

Sub AddRowSubTotalsBoth()
'Adds blank rows to the Sub-totaled sheet for easier reading
'Also changes font on the first 30 columns from the left to BOLD
Dim lastrow As Long
Dim r As Long

lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is

number
'of columns from "A" that the macro is supposed to BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert

End If
Next
End Sub

I use it to add blank rows to separate and make bold the Subtotals of
reports (obtained using the Data Subtotals feature) to make the

subtotal
titles and values easier to read. There are two different reports I

use
this macro with. One has the word total in a string in column "C" and

the
other has it in column "H". It all works fine except for the bottommost
subtotal and the Grand Total values in both reports.......these two

values,
both in Column "X" are left normal font, even tho their titles in column

"C"
or "H" respectively are bolded. The subtotals of the upper groups, also

in
column "X" DO get bolded........just these two don't.

Also, there is no insertion of a blank row between the bottommost

Subtotal
and the Grand total..........but this is not as serious as the two

values
not being bold.


Any help to insure these last two get changed to Bold Font ( and maybe

the
last blank row insertion), would be appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3






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
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) AndyCotgreave Excel Discussion (Misc queries) 3 October 24th 07 11:32 AM
Problem with Subtotals praveen_khm Excel Worksheet Functions 1 January 11th 06 03:40 PM
Problem with nested subtotals, placing secondary subtotals BELOW . Dawn Cameron Excel Discussion (Misc queries) 1 June 3rd 05 10:13 PM
Subtotals Problem when Filtering Brenda Rueter Excel Discussion (Misc queries) 2 February 15th 05 09:05 PM
SubTotals Problem P Britt Excel Programming 0 February 13th 04 08:41 PM


All times are GMT +1. The time now is 02:52 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"