+ Reply to Thread
Results 1 to 7 of 7

repeated end(xldown)

  1. #1
    R.VENKATARAMAN
    Guest

    repeated end(xldown)

    i have to write
    activecell.end(xldown).end(xldown).end(xldown).select

    is there easier way of writing this repeated functions.



  2. #2
    Doug Glancy
    Guest

    Re: repeated end(xldown)

    I you're trying to select the last non-blank cell in the column then this
    would work:

    Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select

    ht,

    Doug


    "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    news:[email protected]...
    >i have to write
    > activecell.end(xldown).end(xldown).end(xldown).select
    >
    > is there easier way of writing this repeated functions.
    >
    >




  3. #3
    R.VENKATARAMAN
    Guest

    Re: repeated end(xldown)

    thanks.
    that is not the last non blank cell but i have to come down to a particular
    cell which needs end(xldonw) 2 or 3 times.
    is there something like
    <end(xldown)(2)>
    if know this gives me some other cell i.e. gives me
    end(xldown).offset(1,0)

    my data is
    1
    2
    3
    (two blank cells)

    4
    5
    6
    I want to go to 4
    <range("a1").end(xldown).end(xldown).select >gives 4







    "Doug Glancy" <[email protected]> wrote in message
    news:[email protected]...
    > I you're trying to select the last non-blank cell in the column then this
    > would work:
    >
    > Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
    >
    > ht,
    >
    > Doug
    >
    >
    > "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > news:[email protected]...
    > >i have to write
    > > activecell.end(xldown).end(xldown).end(xldown).select
    > >
    > > is there easier way of writing this repeated functions.
    > >
    > >

    >
    >




  4. #4
    Doug Glancy
    Guest

    Re: repeated end(xldown)

    Is it always the next cell after the first two blank cells, but the row can
    be different? If so, I think your solution is as good as any. You could
    also do something like:

    Range("A1").End(xlDown).Offset(3).Select

    but it looks like you've thought of something like that. I need a better
    description of the pattern.

    hth,

    Doug


    "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    news:%[email protected]...
    > thanks.
    > that is not the last non blank cell but i have to come down to a
    > particular
    > cell which needs end(xldonw) 2 or 3 times.
    > is there something like
    > <end(xldown)(2)>
    > if know this gives me some other cell i.e. gives me
    > end(xldown).offset(1,0)
    >
    > my data is
    > 1
    > 2
    > 3
    > (two blank cells)
    >
    > 4
    > 5
    > 6
    > I want to go to 4
    > <range("a1").end(xldown).end(xldown).select >gives 4
    >
    >
    >
    >
    >
    >
    >
    > "Doug Glancy" <[email protected]> wrote in message
    > news:[email protected]...
    >> I you're trying to select the last non-blank cell in the column then this
    >> would work:
    >>
    >> Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
    >>
    >> ht,
    >>
    >> Doug
    >>
    >>
    >> "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    >> news:[email protected]...
    >> >i have to write
    >> > activecell.end(xldown).end(xldown).end(xldown).select
    >> >
    >> > is there easier way of writing this repeated functions.
    >> >
    >> >

    >>
    >>

    >
    >




  5. #5

    Re: repeated end(xldown)

    thanks for your patience.
    the number of blank cells is variable after first set of non blank
    cells.




    Doug Glancy wrote:
    > Is it always the next cell after the first two blank cells, but the row can
    > be different? If so, I think your solution is as good as any. You could
    > also do something like:
    >
    > Range("A1").End(xlDown).Offset(3).Select
    >
    > but it looks like you've thought of something like that. I need a better
    > description of the pattern.
    >
    > hth,
    >
    > Doug
    >
    >
    > "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > news:%[email protected]...
    > > thanks.
    > > that is not the last non blank cell but i have to come down to a
    > > particular
    > > cell which needs end(xldonw) 2 or 3 times.
    > > is there something like
    > > <end(xldown)(2)>
    > > if know this gives me some other cell i.e. gives me
    > > end(xldown).offset(1,0)
    > >
    > > my data is
    > > 1
    > > 2
    > > 3
    > > (two blank cells)
    > >
    > > 4
    > > 5
    > > 6
    > > I want to go to 4
    > > <range("a1").end(xldown).end(xldown).select >gives 4
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > "Doug Glancy" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> I you're trying to select the last non-blank cell in the column then this
    > >> would work:
    > >>
    > >> Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
    > >>
    > >> ht,
    > >>
    > >> Doug
    > >>
    > >>
    > >> "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > >> news:[email protected]...
    > >> >i have to write
    > >> > activecell.end(xldown).end(xldown).end(xldown).select
    > >> >
    > >> > is there easier way of writing this repeated functions.
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >



  6. #6
    Dave Peterson
    Guest

    Re: repeated end(xldown)

    Maybe you could just loop the number of times you need:

    dim HowMany as long
    dim iCtr as long
    dim DestCell as Range

    howmany = 3

    set destcell = range("a1")

    for ictr = 1 to howmany
    set destcell = destcell.end(xldown)
    next ictr

    msgbox destcell.address

    [email protected] wrote:
    >
    > thanks for your patience.
    > the number of blank cells is variable after first set of non blank
    > cells.
    >
    > Doug Glancy wrote:
    > > Is it always the next cell after the first two blank cells, but the row can
    > > be different? If so, I think your solution is as good as any. You could
    > > also do something like:
    > >
    > > Range("A1").End(xlDown).Offset(3).Select
    > >
    > > but it looks like you've thought of something like that. I need a better
    > > description of the pattern.
    > >
    > > hth,
    > >
    > > Doug
    > >
    > >
    > > "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > > news:%[email protected]...
    > > > thanks.
    > > > that is not the last non blank cell but i have to come down to a
    > > > particular
    > > > cell which needs end(xldonw) 2 or 3 times.
    > > > is there something like
    > > > <end(xldown)(2)>
    > > > if know this gives me some other cell i.e. gives me
    > > > end(xldown).offset(1,0)
    > > >
    > > > my data is
    > > > 1
    > > > 2
    > > > 3
    > > > (two blank cells)
    > > >
    > > > 4
    > > > 5
    > > > 6
    > > > I want to go to 4
    > > > <range("a1").end(xldown).end(xldown).select >gives 4
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Doug Glancy" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > >> I you're trying to select the last non-blank cell in the column then this
    > > >> would work:
    > > >>
    > > >> Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
    > > >>
    > > >> ht,
    > > >>
    > > >> Doug
    > > >>
    > > >>
    > > >> "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > > >> news:[email protected]...
    > > >> >i have to write
    > > >> > activecell.end(xldown).end(xldown).end(xldown).select
    > > >> >
    > > >> > is there easier way of writing this repeated functions.
    > > >> >
    > > >> >
    > > >>
    > > >>
    > > >
    > > >


    --

    Dave Peterson

  7. #7
    Doug Glancy
    Guest

    Re: repeated end(xldown)

    You could wrap what Dave is suggesting in a function:

    Sub test()
    repeated_downs(ActiveCell, 3).Select
    End Sub

    Function repeated_downs(startcell As Range, howmany As Long) As Range
    Dim destcell As Range
    Dim ictr As Long

    Set destcell = startcell
    For ictr = 1 To howmany
    Set destcell = destcell.End(xlDown)
    Next ictr
    Set repeated_downs = destcell
    End Function

    hth,

    Doug

    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > Maybe you could just loop the number of times you need:
    >
    > dim HowMany as long
    > dim iCtr as long
    > dim DestCell as Range
    >
    > howmany = 3
    >
    > set destcell = range("a1")
    >
    > for ictr = 1 to howmany
    > set destcell = destcell.end(xldown)
    > next ictr
    >
    > msgbox destcell.address
    >
    > [email protected] wrote:
    > >
    > > thanks for your patience.
    > > the number of blank cells is variable after first set of non blank
    > > cells.
    > >
    > > Doug Glancy wrote:
    > > > Is it always the next cell after the first two blank cells, but the

    row can
    > > > be different? If so, I think your solution is as good as any. You

    could
    > > > also do something like:
    > > >
    > > > Range("A1").End(xlDown).Offset(3).Select
    > > >
    > > > but it looks like you've thought of something like that. I need a

    better
    > > > description of the pattern.
    > > >
    > > > hth,
    > > >
    > > > Doug
    > > >
    > > >
    > > > "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > > > news:%[email protected]...
    > > > > thanks.
    > > > > that is not the last non blank cell but i have to come down to a
    > > > > particular
    > > > > cell which needs end(xldonw) 2 or 3 times.
    > > > > is there something like
    > > > > <end(xldown)(2)>
    > > > > if know this gives me some other cell i.e. gives me
    > > > > end(xldown).offset(1,0)
    > > > >
    > > > > my data is
    > > > > 1
    > > > > 2
    > > > > 3
    > > > > (two blank cells)
    > > > >
    > > > > 4
    > > > > 5
    > > > > 6
    > > > > I want to go to 4
    > > > > <range("a1").end(xldown).end(xldown).select >gives 4
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Doug Glancy" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > >> I you're trying to select the last non-blank cell in the column

    then this
    > > > >> would work:
    > > > >>
    > > > >> Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
    > > > >>
    > > > >> ht,
    > > > >>
    > > > >> Doug
    > > > >>
    > > > >>
    > > > >> "R.VENKATARAMAN" <vram26@vsnl$$$.net> wrote in message
    > > > >> news:[email protected]...
    > > > >> >i have to write
    > > > >> > activecell.end(xldown).end(xldown).end(xldown).select
    > > > >> >
    > > > >> > is there easier way of writing this repeated functions.
    > > > >> >
    > > > >> >
    > > > >>
    > > > >>
    > > > >
    > > > >

    >
    > --
    >
    > Dave Peterson




+ 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