Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2001
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select a cell in a macro (Excel 2002 SP3)

    A long time ago I got the following macro from someone in this forum.
    I created a button that executes this macro. After clicking the button, the selected cell remains at the button's position.

    Sub Lastrow()
    Range("a1").Select
    r = 7
    checkagain:
    If IsEmpty(ActiveSheet.Cells(r, 2).Value) = True Then
    GoTo sof
    Else
    r = r + 1
    GoTo checkagain
    End If
    sof:
    ActiveSheet.Range(Cells(r - 1, 2), Cells(r - 1, 9)).Name = "last_line"
    End Sub

    Can I add to this macro, so after clicking the button, the first empty cell at the end of column B, will be selected? I think it should be Cell(r,2).

    Thank in advance,
    Avi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select a cell in a macro (Excel 2002 SP3)

    You can remove the line

    Range("a1").Select

    at the beginning, and add the following line at the end:

    ActiveSheet.Cells(r, 2).Select

  3. #3
    New Lounger
    Join Date
    Nov 2001
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select a cell in a macro (Excel 2002 SP3)

    Thank you very much

Posting Permissions

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