+ Reply to Thread
Results 1 to 6 of 6

Identifying Top row

  1. #1
    teresa
    Guest

    Identifying Top row

    I have 20 rows,


    if the first row is the 5th row e.g.A5 or B5,
    then I want Y5 = "GM" ETC.ETC.

    So something like:

    Y(Cells(Rows.Count, 1).End(xlUp).Row)= "GM"

    obviously not End(xlUp).Row but something similar

    Thks




  2. #2
    Tom Ogilvy
    Guest

    Re: Identifying Top row

    Range("Y" & Cells(Rows.Count, 1).End(xlUp).Row).Value = "GM"

    --
    Regards,
    Tom Ogilvy

    "teresa" <[email protected]> wrote in message
    news:[email protected]...
    > I have 20 rows,
    >
    >
    > if the first row is the 5th row e.g.A5 or B5,
    > then I want Y5 = "GM" ETC.ETC.
    >
    > So something like:
    >
    > Y(Cells(Rows.Count, 1).End(xlUp).Row)= "GM"
    >
    > obviously not End(xlUp).Row but something similar
    >
    > Thks
    >
    >
    >




  3. #3
    Alan Beban
    Guest

    Re: Identifying Top row

    Tom Ogilvy wrote:
    > Range("Y" & Cells(Rows.Count, 1).End(xlUp).Row).Value = "GM"
    >

    Doesn't do it; if you want the first row in Column A to control try

    Range("Y" & Range("A1").End(xlDown).Row).Value = "GM"

    If you want Column B to control, change the A1 to B1

    Alan Beban

  4. #4
    Tom Ogilvy
    Guest

    Re: Identifying Top row

    Thanks, misread the question.

    --
    Regards,
    Tom Ogilvy

    "Alan Beban" <[email protected]> wrote in message
    news:%23NYkhRB%[email protected]...
    > Tom Ogilvy wrote:
    > > Range("Y" & Cells(Rows.Count, 1).End(xlUp).Row).Value = "GM"
    > >

    > Doesn't do it; if you want the first row in Column A to control try
    >
    > Range("Y" & Range("A1").End(xlDown).Row).Value = "GM"
    >
    > If you want Column B to control, change the A1 to B1
    >
    > Alan Beban




  5. #5
    Alan Beban
    Guest

    Re: Identifying Top row

    Alan Beban wrote:
    > Tom Ogilvy wrote:
    >
    >> Range("Y" & Cells(Rows.Count, 1).End(xlUp).Row).Value = "GM"
    >>

    > Doesn't do it; if you want the first row in Column A to control try
    >
    > Range("Y" & Range("A1").End(xlDown).Row).Value = "GM"
    >
    > If you want Column B to control, change the A1 to B1
    >
    > Alan Beban

    And if it isn't known whether Column A or B should be the control, one
    might try

    Range("Y" & Application.Min(Range("A1").End(xlDown).Row, _
    Range("B1").End(xlDown).Row)).Value = "GM"

    Alan Beban

  6. #6
    Harlan Grove
    Guest

    Re: Identifying Top row

    "Alan Beban" <[email protected]> wrote...
    ....
    >Doesn't do it; if you want the first row in Column A to control try
    >
    >Range("Y" & Range("A1").End(xlDown).Row).Value = "GM"
    >
    >If you want Column B to control, change the A1 to B1


    Doesn't work if A1 (or B1) is the only nonblank cell in its column. And if
    A1:A# were all nonblank, this would give the bottommost row in that range of
    nonblank cells.

    If col A should control, shouldn't this be

    Range("Y" & IIf(IsEmpty(Range("A1").Value), _
    Range("A1").End(xlDown).Row, 1)).Value = "GM"



+ 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