Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 9 of 9

Thread: Next clear cell in a table

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    Manchester UK
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I know it can be done and its probably really easy but does anyone know how to get to the next clear cell in a column, and select it. For example

    Sub NextClearCell()
    Range("A1").Select
    Selection.End(xlDown).Select
    End

    This will take me to the last cell with something in but how do i get to the next empty cell???

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi
    Maybe this?

    Sub NextClearCell()
    Range("A1").Select
    Selection.End(xlDown).Activate
    Range("A" & ActiveCell.Row + 1).Select
    End Sub

    Tom

    [ This Message was edited by: TsTom on 2002-04-25 05:03 ]

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    Manchester UK
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    it just selects A1?? rather than the botom of the table

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this:

    Application.Goto Reference:="R65536C1"
    Selection.End(xlUp).Select

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub NextClearCell()
    Dim LastRow
    NextRow = Range("a1:a" & Range("A65536").End(xlUp).Row).Rows.Count + 1
    Cells(NextRow, 1).Select
    End Sub

    Joe,
    I tried yours and it selects the last used cell of the range.
    This one does work.

  6. #6
    Board Regular
    Join Date
    Apr 2002
    Location
    Manchester UK
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    cheers for your help so far but when i tried to change this code so it works on column E instead of A it will find the next clear row but selects the next clear row in column A even if the data is in E
    This is what i changed from

    Sub NextClearCell()
    Dim LastRow
    NextRow = Range("a1:a" & Range("A65536").End(xlUp).Row).Rows.Count + 1
    Cells(NextRow, 1).Select
    End Sub

    to

    Sub NextClearCell()
    Dim LastRow
    NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
    Cells(NextRow, 1).Select
    End Sub

  7. #7
    Board Regular
    Join Date
    Apr 2002
    Location
    Manchester UK
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Can anyone help????

  8. #8
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub NextClearCell()
    Dim LastRow
    NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
    Cells(NextRow, 5).Select
    End Sub



    Culprit = Cells(NextRow, 1).Select
    where 1 = column 1
    change to 5

    Tom

  9. #9
    Board Regular
    Join Date
    Apr 2002
    Location
    Manchester UK
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks TsTom that works wonders it also works if you replace the column reference number (After [NextRow, #]) with the letter in "" e.g. "E". Just incase anyone ever needs this, because it is really useful!!

    Sub NextClearCell()
    Dim LastRow
    NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
    Cells(NextRow, "E").Select
    End Sub

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •