View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Paul is offline
external usenet poster
 
Posts: 661
Default Error 13 Type Mismatch

Is this a case of substituting :

If c.Value = "" Then

for

If IsEmpty(c.Value) Then

"Justin" wrote:

This code is to hide the entire row if the cell in column D is empty.

This code returns the Type MisMatch error:

Sub hideme()
Application.ScreenUpdating = False
Dim myrange As Range, myrange1 As Range
lastrow = Cells(Rows.Count, "D").End(xlUp).Row
Set myrange = Range("D4:D" & lastrow)
For Each c In myrange
If c.Value = "" Then
If myrange1 Is Nothing Then
Set myrange1 = c.EntireRow
Else
Set myrange1 = Union(myrange1, c.EntireRow)
End If
End If
Next
myrange1.EntireRow.Hidden = True
End Sub

It also does work in my 2003 version but doesn't in the 2007... anyone know
why this is?