+ Reply to Thread
Results 1 to 8 of 8

How to count last column of data

  1. #1
    crapit
    Guest

    How to count last column of data

    Using excel VBa, I can count last row of data using lastrow =
    Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    But how to use it for column?



  2. #2
    Ardus Petus
    Guest

    Re: How to count last column of data

    lastcol=Worksheets("Spare2").cells(rows.count,1).end(xltoleft).column

    HTH
    --
    AP

    "crapit" <[email protected]> a écrit dans le message de news:
    [email protected]...
    > Using excel VBa, I can count last row of data using lastrow =
    > Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    > But how to use it for column?
    >




  3. #3
    Bob Phillips
    Guest

    Re: How to count last column of data

    Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column

    for the last column in the first row

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "crapit" <[email protected]> wrote in message
    news:[email protected]...
    > Using excel VBa, I can count last row of data using lastrow =
    > Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    > But how to use it for column?
    >
    >




  4. #4
    crapit
    Guest

    Re: How to count last column of data

    IT works!
    "Bob Phillips" <[email protected]> wrote in message
    news:%[email protected]...
    > Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column
    >
    > for the last column in the first row
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "crapit" <[email protected]> wrote in message
    > news:[email protected]...
    >> Using excel VBa, I can count last row of data using lastrow =
    >> Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    >> But how to use it for column?
    >>
    >>

    >
    >




  5. #5
    crapit
    Guest

    Re: How to count last column of data

    didnt work
    "Ardus Petus" <[email protected]> wrote in message
    news:%[email protected]...
    > lastcol=Worksheets("Spare2").cells(rows.count,1).end(xltoleft).column
    >
    > HTH
    > --
    > AP
    >
    > "crapit" <[email protected]> a écrit dans le message de news:
    > [email protected]...
    >> Using excel VBa, I can count last row of data using lastrow =
    >> Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    >> But how to use it for column?
    >>

    >
    >




  6. #6
    Ardus Petus
    Guest

    Re: How to count last column of data

    Typed too fast!

    "crapit" <[email protected]> a écrit dans le message de news:
    %[email protected]...
    > didnt work
    > "Ardus Petus" <[email protected]> wrote in message
    > news:%[email protected]...
    >> lastcol=Worksheets("Spare2").cells(rows.count,1).end(xltoleft).column
    >>
    >> HTH
    >> --
    >> AP
    >>
    >> "crapit" <[email protected]> a écrit dans le message de news:
    >> [email protected]...
    >>> Using excel VBa, I can count last row of data using lastrow =
    >>> Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    >>> But how to use it for column?
    >>>

    >>
    >>

    >
    >




  7. #7
    crapit
    Guest

    Re: How to count last column of data

    But how doI get the actual column "R" value?

    "Bob Phillips" <[email protected]> wrote in message
    news:%[email protected]...
    > Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column
    >
    > for the last column in the first row
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "crapit" <[email protected]> wrote in message
    > news:[email protected]...
    >> Using excel VBa, I can count last row of data using lastrow =
    >> Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    >> But how to use it for column?
    >>
    >>

    >
    >




  8. #8
    Bob Phillips
    Guest

    Re: How to count last column of data

    myVal = Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft)

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Bob Phillips" <[email protected]> wrote in message
    news:%[email protected]...
    > Worksheets("Spare2").Cells(1,Columns.count).End(xlToLeft).Column
    >
    > for the last column in the first row
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "crapit" <[email protected]> wrote in message
    > news:[email protected]...
    > > Using excel VBa, I can count last row of data using lastrow =
    > > Worksheets("Spare2").Cells(Rows.count, 1).End(xlUp).row
    > > But how to use it for column?
    > >
    > >

    >
    >




+ 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