+ Reply to Thread
Results 1 to 4 of 4

Check if a Table is empty using VB

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    16

    Check if a Table is empty using VB

    Hi guys, not sure if this has been posted before but i couldn't find anything to answer my questions.

    I have a table in excel range B5:M32 with the top two rows containing merged cells (B5:M6). I need to write a macro to copy data from cells B38:C38 into the above table.

    I need the macro to first check to see if there is any data already entered i.e. check if the table is empty. If it is empty then paste the cells in the first cell (B7). If the table already has data entered i need to move to the last entry then move down one cell and paste the copied cells.

    I have figures out the copying/pasting functions but am struggling with the part to check if the table is empty and moving down the table without using cell references.

    Any help would be much appreciated.

    Martin

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Check if a Table is empty using VB

    Try this

    Please Login or Register  to view this content.
    Martin

  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: Check if a Table is empty using VB

    You want to avoid Merged Cells, use centre across selection instead. Here's an alternative
    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    02-08-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Check if a Table is empty using VB

    Quote Originally Posted by mrice View Post
    Try this

    Please Login or Register  to view this content.
    Hi

    Thanks to both the posts, i've used mrice's suggestions and this seems to work perfectly and easier to understand for a novice like myself.

    Much appreciated for both your comments.

    Martin

+ 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