+ Reply to Thread
Results 1 to 5 of 5

Determine Last Row And Column With Data In Sheets With Merged Cells

  1. #1
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92

    Determine Last Row And Column With Data In Sheets With Merged Cells

    I am using the following functions to determine the highest row and column that contain data:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I've just inherited a spreadsheet which contains merged cells and it would seem these merged cells cause the above functions to fail, on the lines in bold, with a Run-time error '91' "Object variable or with block variable not set".

    The real problem is the spreadsheet, I've just started a new job and the spreadsheet I've inherited is horrible, 90+ sheets filled with all sorts of crap. However redoing the spreadsheet in a sane fashion isn't really an option at the moment and I need to get on with identifying all the cells with errors and fixing them so does anyone know of a way in which to deal with merged cells when trying to determine the highest column and highest row to contain data?
    Last edited by chergh; 01-28-2009 at 10:11 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Determine Last Row And Column With Data In Sheets With Merged Cells

    As you have found out merged cells can be a nightmare. I think a different approach is needed, are the errors formula related?
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Determine Last Row And Column With Data In Sheets With Merged Cells

    You might be able to use this

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92

    Re: Determine Last Row And Column With Data In Sheets With Merged Cells

    Many thanks that seems to work nicely

    For anyone else who is going to use it, you need to add an "end if"

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Determine Last Row And Column With Data In Sheets With Merged Cells

    You don't need the End If, it's one line split

+ 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