View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Going to the first blank cell in the selected column

Another one

Sub test()
On Error GoTo BodemUp
Columns("A").Cells.SpecialCells(xlCellTypeBlanks). Cells(1).Select
Exit Sub
BodemUp: Cells(Rows.Count, "A").End(xlUp)(2).Select
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Norman Jones" wrote in message ...
Hi LoveCandle,

To additionally allow for data in the first cell of the active column or, alternatively, for a fully populated column, try:

Public Sub Blank()
Dim rng As Range

Set rng = ActiveCell.EntireColumn.Cells(1)

If IsEmpty(rng) Then GoTo Blank_Column

If IsEmpty(rng(2)) Then
rng(2).Select
Else
On Error GoTo XIT
rng.End(xlDown)(2).Select
On Error GoTo 0
End If

Exit Sub

Blank_Column:
MsgBox "There is no data in the first cell of this column", , "No Data"
Exit Sub

XIT:
MsgBox "The column is full!", , "No room!"

End Sub
'===============

---
Regards,
Norman



"LoveCandle" wrote in message
...

Thank you soooooo much Norman ..

The code is fantastic .. but I had to add something to be working
perfectly,


Code:
--------------------
Sub Blank()
On Error GoTo Blank_Column
Cells(1, ActiveCell.Column).End(xlDown)(2).Select
Blank_Column:
If Err = 1004 Then
MsgBox "There is no data in this column", , "No Data"
End If
End Sub
--------------------


Thank you again Norman


--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612
View this thread: http://www.excelforum.com/showthread...hreadid=486621