|
-
Mar 4th, 2002, 06:48 AM
#4
Addicted Member
Try this....it will test your column.....it is slow as it will test all cells for a value
Sub Macro1()
Dim rngRange As Range
Dim bEmpty As Boolean
Dim iCounter As Integer
Set rngRange = Selection
bEmpty = True
For iCounter = Asc("A") To Asc("Z")
Sheets("Sheet1").Columns(Chr(iCounter) & ":" & Chr(iCounter)).Select
While bEmpty
For Each rngRange In Selection
Application.StatusBar = rngRange.Address
DoEvents
If rngRange <> "" Then
bEmpty = False
MsgBox " FOUND VALUE"
Exit For
Else
'Do nothing
End If
Next
Wend
If bEmpty Then
Exit For
Else
bEmpty = True
End If
Next
MsgBox "column" & Selection.Column & " is empty"
End Sub
Another possibility:
Selection.SpecialCells(xlCellTypeLastCell).Select
This selects the last used cell....meaning the next row (to be retrieved with the selection object) will be empty
We have the technology and we are not afraid to use it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|