S
StargateFan
I found a macro that hopefully will do what I need, to select the rows
in an active sheet that have text in them. In other words, so that
blank rows aren't chosen, too.
*******************************************************************************
Sub SelectNonEmptyRows()
Dim Flag As Boolean
Dim R As Range
Dim Rng As Range
With ActiveSheet
Flag = False
For R = 1 To .Cells.SpecialCells(xlCellTypeLastCell).Row
If Application.CountA(.Rows(R).Cells) <> 0 Then
If Flag = False Then
Set Rng = .Rows(R)
Else
Set Rng = Union(Rng, .Rows(R))
End If
Flag = True
End If
Next R
If Flag = False Then
MsgBox "Worksheet is Empty"
Else
Rng.Select
End If
End With
End Sub
*******************************************************************************
I found this here:
http://groups.google.ca/group/micro...+non-empty-rows&rnum=8&hl=en#dadf88255b886b57
OP said it worked for them but I get this error:
Compile error: Type mismatch
With the "R" in the line "For R" selected.
TIA for any help. D
in an active sheet that have text in them. In other words, so that
blank rows aren't chosen, too.
*******************************************************************************
Sub SelectNonEmptyRows()
Dim Flag As Boolean
Dim R As Range
Dim Rng As Range
With ActiveSheet
Flag = False
For R = 1 To .Cells.SpecialCells(xlCellTypeLastCell).Row
If Application.CountA(.Rows(R).Cells) <> 0 Then
If Flag = False Then
Set Rng = .Rows(R)
Else
Set Rng = Union(Rng, .Rows(R))
End If
Flag = True
End If
Next R
If Flag = False Then
MsgBox "Worksheet is Empty"
Else
Rng.Select
End If
End With
End Sub
*******************************************************************************
I found this here:
http://groups.google.ca/group/micro...+non-empty-rows&rnum=8&hl=en#dadf88255b886b57
OP said it worked for them but I get this error:
Compile error: Type mismatch
With the "R" in the line "For R" selected.
TIA for any help. D