C
Chrisso
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
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