Type Mismatch on some PCs
If you don't want to change the value in the cell you could do
Range("C12:C514").Select
For Each cell In Selection
If cell.Interior.ColorIndex = 45 Then
cell.Value = False
End If
Next cell
Range("C12:C514").Select
For Each cell In Selection
If cell.Text = "True" Then ' <== change
cell.EntireRow.Hidden = False
Else
cell.EntireRow.Hidden = True
End If
Next cell
--
Regards,
Tom Ogilvy
"gocush" /delete wrote in message
...
Try adding two lines to the first section of code:
Range("C12:C514").Select
For Each cell In Selection
If cell.Interior.ColorIndex = 45 Then
cell.Value = False
Else
cell.Value = True
End If
Next cell
"Delboy" wrote:
I have an Excel workbook which has some code on one of the sheets. All
this
does is hide or unhide rows depending on whether there word true is
found in
column C (in the row thath will be hidden or revealed). The true/false
is
created from a tick box which the user selects, there are a number of
them.
So far, its all straight forward and this works on 98% of peoples PCs,
but
some people get a Run time error, type mismatch when they click a tick
box.
They are all running the same system Win XP and Excel 2002. Has anybody
got
any ideas on how to fix this? The code is as follows:
Range("C12:C514").Select
For Each cell In Selection
If cell.Interior.ColorIndex = 45 Then
cell.Value = False
End If
Next cell
Range("C12:C514").Select
For Each cell In Selection
If cell = True Then
cell.EntireRow.Hidden = False
Else
cell.EntireRow.Hidden = True
End If
Next cell
|