LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Counting number of rows with Cond. Formatting to avoid save problem (KB 215783)

Hi Chaps

I have hit the problem where I get the following message when I save
my large, old xls:

"Excel could not save all the data and formatting you recently added
to <my file.xls"

I have read through these groups and the MS KB and it seems the only
reason this would happen is if I exceed 2050 rows of conditional
formatting.

I have written some code to try determine how many rows I have
conditional formatting - but this tells me I have only 1772 rows.

My code is below - can anyone see anything wrong with it which may be
under reporting the number of lines with CF? Does anyone have any
other similar utilties to attack this problem?

Otherwise this cond. formatting limitation may not be my problem- does
anyone have any ideas on other possible causes?

Many thanks for any ideas.
Chrisso

Sub CF2050_Report_All_Sheets()
Application.ScreenUpdating = False

Dim totalCount, thisRowCount, thisSheetCount As Long
Dim cell As Range
Dim wrkSheet As Worksheet
Dim report As String

For Each wrkSheet In Worksheets
wrkSheet.Activate
thisSheetCount = 0

' determine the last cell - no need to look past it
Dim lastCell As Range
Set lastCell = Range("A1").SpecialCells(xlLastCell)
' loop through each row till the last cell
For myRow = 1 To lastCell.Row
thisRowCount = 0
' only need to look as far as the last cell column
For Each cell In Range(Cells(myRow, 1), Cells(myRow,
lastCell.Column))
If cell.FormatConditions.Count 0 Then thisRowCount =
thisRowCount + 1
Next
If thisRowCount 0 Then thisSheetCount = thisSheetCount +
1
Next myRow

' add to our count and report
totalCount = totalCount + thisSheetCount
report = report & wrkSheet.Name & ": " & thisSheetCount & vbCr
Next

Application.ScreenUpdating = True
MsgBox "Total Count of Rows With CF: " & totalCount & vbCr & vbCr
& report
End Sub

 
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
Counting number of rows Lynne Mawson New Users to Excel 1 May 8th 08 05:56 PM
Counting number of rows Lynne Mawson New Users to Excel 0 May 8th 08 03:53 PM
Counting number of rows that are not N/A Barb Reinhardt Excel Programming 2 September 14th 06 07:12 PM
Avoid counting rows/columns with formula but no values magnuc Excel Programming 0 August 22nd 06 11:30 AM
Counting the number of rows blurboiboi Excel Worksheet Functions 1 July 13th 05 11:20 AM


All times are GMT +1. The time now is 08:49 AM.

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"