+ Reply to Thread
Results 1 to 7 of 7

If Statement Before Save

Hybrid View

  1. #1
    ChasAA
    Guest

    RE: If Statement Before Save

    This should do it:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    For Each cell In Range("A1:F6000")
    If cell.Interior.ColorIndex = 44 Then
    MsgBox "Sheet has Orange Cells"
    End If
    Next
    End Sub

    Chas

    "scottnshelly" wrote:

    >
    > I want a message box to pop up if there are any orange cells on sheet1.
    > The click event will be BeforeSave. I have some conditional formatting
    > that changes a cell to orange. I don't want the user to be able to
    > save if there is orange on the sheet. The orange can appear in
    > A1:F6000.
    >
    > What does the If statement look like for this scenario?
    >
    > Thanks.
    >
    >
    > --
    > scottnshelly
    > ------------------------------------------------------------------------
    > scottnshelly's Profile: http://www.excelforum.com/member.php...fo&userid=7301
    > View this thread: http://www.excelforum.com/showthread...hreadid=570535
    >
    >


  2. #2
    Bob Phillips
    Guest

    Re: If Statement Before Save

    CF Chas, not cell colour.

    --
    HTH

    Bob Phillips

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

    "ChasAA" <ChasAA@discussions.microsoft.com> wrote in message
    news:1CAC03F6-513D-4701-802E-0B315DF93E8B@microsoft.com...
    > This should do it:
    >
    > Private Sub Workbook_BeforeClose(Cancel As Boolean)
    > For Each cell In Range("A1:F6000")
    > If cell.Interior.ColorIndex = 44 Then
    > MsgBox "Sheet has Orange Cells"
    > End If
    > Next
    > End Sub
    >
    > Chas
    >
    > "scottnshelly" wrote:
    >
    > >
    > > I want a message box to pop up if there are any orange cells on sheet1.
    > > The click event will be BeforeSave. I have some conditional formatting
    > > that changes a cell to orange. I don't want the user to be able to
    > > save if there is orange on the sheet. The orange can appear in
    > > A1:F6000.
    > >
    > > What does the If statement look like for this scenario?
    > >
    > > Thanks.
    > >
    > >
    > > --
    > > scottnshelly
    > > ------------------------------------------------------------------------
    > > scottnshelly's Profile:

    http://www.excelforum.com/member.php...fo&userid=7301
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=570535
    > >
    > >




+ 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