+ Reply to Thread
Results 1 to 8 of 8

establishing last row populated and selecting cells between first and last

  1. #1
    Registered User
    Join Date
    06-10-2008
    Posts
    13

    establishing last row populated and selecting cells between first and last

    Hi,

    ive got a spreadsheet with a large amount of data, im trying to automate a button that searches down the column "A" until it hits the end.

    i have used the code:

    ActiveCell.Value = ActiveSheet.Range("A65536").End(xlUp).Row

    this does then do as requested and finds the last row...

    What i want then to do is select column "S" between S1 and S[I]n[I] where n is the last row number found above.

    Why not just do the procedure on column "S" i hear you cry.. well, column "S" may have data beyond the last row of column "A". I dont want this to be picked up.

    Can someone offer me some advice please on how I go about doing the selection?

    Many thanks

    Iain

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Use the offset.
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi Iain,

    See if this fits your need

    Please Login or Register  to view this content.
    Andy Pope got there first
    Hope this helps

    Seamus

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You mightbe able to use UsedRange or CurrentRegion, consult VBA help for each.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    06-10-2008
    Posts
    13
    Morning,

    thanks ever so much for all of your replies!!!

    I have used:
    Please Login or Register  to view this content.
    This has done exactly what I was looking for!

    Thanks ever so much

    Iain
    Last edited by Andy Pope; 06-11-2008 at 05:57 AM.

  6. #6
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    You're welcome. Glad to have helped

    Seamus

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Iain, don't forget to use code tags.

    Also change the data type of your row variable to Long to avoid problems with more than 32k rows at a later date.

  8. #8
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Sorry, Andy, should have noticed that but I'm still learning as well.

    Thanks

    Seamus

+ 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