+ Reply to Thread
Results 1 to 2 of 2

Check if Active Workbook is Empty

  1. #1
    Forum Contributor
    Join Date
    09-27-2004
    Posts
    133

    Question Check if Active Workbook is Empty

    Excel 2003 with Visual Basic 6.3

    I'm sure there must be a way to check and see if the Active Workbook is empty.

    Any clues?

  2. #2
    Tom Ogilvy
    Guest

    Re: Check if Active Workbook is Empty

    What is your definition of empy?

    Possibly

    Dim bEmpty as Boolean, sh as Worksheet
    bEmpty = True
    for each sh in Activeworkbook.Worksheets
    if Application.CountA(sh.UsedRange) <> 0 then
    bEmpty = False
    Exit for
    end if
    Next
    With ActiveWorkbook
    if .Worksheets.count <> .Sheets.count then _
    bEmpty = False
    End With
    if bEmpty then
    msgbox Activeworkbook.Name & " is empty"
    end if

    The above doesn't check for shapes/olebojects or code.

    --
    Regards,
    Tom Ogilvy

    "scantor145" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Excel 2003 with Visual Basic 6.3
    >
    > I'm sure there must be a way to check and see if the Active Workbook is
    > empty.
    >
    > Any clues?
    >
    >
    > --
    > scantor145
    > ------------------------------------------------------------------------
    > scantor145's Profile:

    http://www.excelforum.com/member.php...o&userid=14766
    > View this thread: http://www.excelforum.com/showthread...hreadid=390186
    >




+ 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