+ Reply to Thread
Results 1 to 6 of 6

Selecting last row?

Hybrid View

edward0380 Selecting last row? 02-10-2006, 11:35 AM
Guest Re: Selecting last row? 02-10-2006, 11:50 AM
Guest Re: Selecting last row? 02-10-2006, 11:55 AM
Guest RE: Selecting last row? 02-10-2006, 11:55 AM
Guest Re: Selecting last row? 02-10-2006, 01:20 PM
Guest RE: Selecting last row? 02-10-2006, 03:45 PM
  1. #1
    Registered User
    Join Date
    12-06-2005
    Posts
    3

    Selecting last row?

    I want to have a macro that will select the cell in the last row in column A. How do I do that?

  2. #2
    Gary Keramidas
    Guest

    Re: Selecting last row?

    an example:

    dim lastrow as long
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row

    range("A" & lastrow).value = 1
    --


    Gary


    "edward0380" <edward0380.230skm_1139586002.1003@excelforum-nospam.com> wrote in
    message news:edward0380.230skm_1139586002.1003@excelforum-nospam.com...
    >
    > I want to have a macro that will select the cell in the last row in
    > column A. How do I do that?
    >
    >
    > --
    > edward0380
    > ------------------------------------------------------------------------
    > edward0380's Profile:
    > http://www.excelforum.com/member.php...o&userid=29396
    > View this thread: http://www.excelforum.com/showthread...hreadid=511077
    >




  3. #3
    Don Guillett
    Guest

    Re: Selecting last row?

    this will do but why do you want to select. Try to write code that does not
    require any selections.

    lastrow=cells(rows.count,"a").end(xlup).row
    cells(lastrow,"a").select

    or
    cells(lastrow,"a")=cells(44,4).value

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "edward0380" <edward0380.230skm_1139586002.1003@excelforum-nospam.com> wrote
    in message news:edward0380.230skm_1139586002.1003@excelforum-nospam.com...
    >
    > I want to have a macro that will select the cell in the last row in
    > column A. How do I do that?
    >
    >
    > --
    > edward0380
    > ------------------------------------------------------------------------
    > edward0380's Profile:
    > http://www.excelforum.com/member.php...o&userid=29396
    > View this thread: http://www.excelforum.com/showthread...hreadid=511077
    >




  4. #4
    galimi
    Guest

    RE: Selecting last row?

    range("a1").Offset(sheet1.UsedRange.Row-1).Select

    Replace sheet1 with the sheet object name.
    --
    http://HelpExcel.com
    1-888-INGENIO
    1-888-464-3646
    x0197758


    "edward0380" wrote:

    >
    > I want to have a macro that will select the cell in the last row in
    > column A. How do I do that?
    >
    >
    > --
    > edward0380
    > ------------------------------------------------------------------------
    > edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396
    > View this thread: http://www.excelforum.com/showthread...hreadid=511077
    >
    >


  5. #5
    Zack Barresse
    Guest

    Re: Selecting last row?

    Hi,

    UsedRange can be unreliable for finding the last known row/column.

    Also, Rows.Count/End(xlUp) will not look at formulas which return a null
    value.

    --
    Regards,
    Zack Barresse, aka firefytr, (GT = TFS FF Zack)
    To email, remove the NO SPAM. Please keep correspondence to the board, as
    to benefit others.


    "galimi" <ed@HelpExcel.com> wrote in message
    news:CDA74E02-35FF-4860-AC0A-C6742CA42C74@microsoft.com...
    > range("a1").Offset(sheet1.UsedRange.Row-1).Select
    >
    > Replace sheet1 with the sheet object name.
    > --
    > http://HelpExcel.com
    > 1-888-INGENIO
    > 1-888-464-3646
    > x0197758
    >
    >
    > "edward0380" wrote:
    >
    >>
    >> I want to have a macro that will select the cell in the last row in
    >> column A. How do I do that?
    >>
    >>
    >> --
    >> edward0380
    >> ------------------------------------------------------------------------
    >> edward0380's Profile:
    >> http://www.excelforum.com/member.php...o&userid=29396
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=511077
    >>
    >>




  6. #6
    Alan Hutchins
    Guest

    RE: Selecting last row?

    The previous replies are all ok, but they might not be exact.

    I have used the following function for years now, and it ALWAYS give steh
    correct result.

    I got it from Rob Bovey and then added a few lines

    Function Goto_Last(strRange, int_col, int_row)
    On Error Resume Next
    Application.ScreenUpdating = False
    Cells(Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row, _
    Cells.Find("*", Range("A1"), , , xlByColumns, xlPrevious).column).Select
    If Err.Number <> 0 Then MsgBox "No data in sheet"
    Application.ScreenUpdating = True
    strRange = ActiveCell.AddressLocal
    int_col = ActiveCell.column
    int_row = ActiveCell.Row
    End Function

    You just add a line to your macro to call the function, and then use the
    data it returns.

    --
    Alan Hutchins


    "edward0380" wrote:

    >
    > I want to have a macro that will select the cell in the last row in
    > column A. How do I do that?
    >
    >
    > --
    > edward0380
    > ------------------------------------------------------------------------
    > edward0380's Profile: http://www.excelforum.com/member.php...o&userid=29396
    > View this thread: http://www.excelforum.com/showthread...hreadid=511077
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1