Microsoft
Software
Hardware
Network
Question : Convert conditional formatting to normal formatting? conditional is lost when converting to Excel 95
Hi!
I have a question that may sound silly: I am trying to convert conditional formatting to normal formatting; the reason is - I have to send some spreadsheets to computers that have Excel 95 and that does not support conditional formatting; my spreadsheet is now formatted to show red if under a certain value, yellow if between limits and green if above a certain value. When I save to 95, all this is lost. I don't know how to paste the formats so that it keeps the cell color, but without conditional formatting. I have to do this process many times a week, formatting manually wouldn't be very inefficient because I have about 30 cells that have to be individually formatted.
Any ideas?
I appreciate your help!!!
Andrea
Answer : Convert conditional formatting to normal formatting? conditional is lost when converting to Excel 95
Andrea,
I can reproduce your problem--VBA was using the FormatConditions from the first cell in the series when using "Formula is". Activating the cell eliminated that problem--see modified sub below.
If you let me know how you were doing Conditional Formatting when you got the Type Mismatch error, I can chase that one down too. Also, please let me know which version of Excel you are using.
Sub NonConditionalFormatting()
Dim cel As Range
Dim boo As Boolean
Dim frmla As String
Dim i As Long
Application.ScreenUpdating
= False
'For Each cel In ActiveSheet.UsedRange 'Remove conditional formatting from entire worksheet
For Each cel In Selection 'Remove conditional formatting from selected cells
If cel.FormatConditions.Count
> 0 Then
cel.Activate
With cel.FormatConditions
For i = 1 To .Count
frmla = .Item(i).Formula1
If Left(frmla, 1) = "=" Then
boo = Application.Evaluate(frmla
)
Else
Select Case .Item(i).Operator
Case xlEqual ' =
frmla = cel & "=" & .Item(i).Formula1
Case xlNotEqual
frmla = cel & "<>" & .Item(i).Formula1
Case xlBetween
frmla = "AND(" & .Item(i).Formula1 & "<=" & cel & "," & cel & "<=" & .Item(i).Formula2 & ")"
Case xlNotBetween
frmla = "OR(" & .Item(i).Formula1 & ">" & cel & "," & cel & ">" & .Item(i).Formula2 & ")"
Case xlLess
frmla = cel & "<" & .Item(i).Formula1
Case xlLessEqual
frmla = cel & "<=" & .Item(i).Formula1
Case xlGreater
frmla = cel & ">" & .Item(i).Formula1
Case xlGreaterEqual
frmla = cel & ">=" & .Item(i).Formula1
End Select
boo = Application.Evaluate(frmla
)
End If
If boo Then
cel.Font.ColorIndex = .Item(i).Font.ColorIndex
cel.Interior.ColorIndex = .Item(i).Interior.ColorInd
ex
Exit For
End If
Next i
.Delete
End With
End If
Next cel
Application.ScreenUpdating
= True
End Sub
Brad
Random Solutions
Bonus points for question
Vista & PAGE_FAULT_IN_NONPAGED_ARE<wbr />A
Error in Stored Proceedure Syntax
Windows 7 unmountable
Communicator desktop sharing - optimise for performance?
Extract sender,subject,priority,at<wbr />tachment from ms outlook using vba
SMTP Mail
Need to know how to access a user control (.ascx) to build a StringBuilder() in another User Control
In Access 2007 what expression would update a value by simply removing all underscores?
Windows Mail to Outlook Express