+ Reply to Thread
Results 1 to 5 of 5

VBA & Conditiona Formatting

  1. #1
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201

    VBA & Conditiona Formatting

    Hi,

    i'm using conditional formatting to turn a cell red if another cell has a certain value in it. If it turns red then i would like a msg to popup. The first code below works if i fill the cell red, rather than use CFormatting. I understand that this 'if' function will not work with CFormatting, so i modified the code to the code at the bottom, but it doesn't work.

    Any ideas...?

    help would be much appreciated

    thanks

    _________________________________________________

    Next Cell

    Set Rng = Sheets("sheet1").Range("m24")
    For Each Cell In Rng
    If Cell.Interior.ColorIndex = 3 Then
    MsgBox "You must FIRST fill in cell " & Cell.Address(0, 0)
    Application.Goto Cell
    Cancel = True
    allIsWell = False
    End If

    ___________________________________________________________

    Next Cell

    Set Rng = Sheets("sheet1").Range("m24")
    For Each Cell In Rng
    If ColorIndexOfCF = 3 Then
    MsgBox "You must FIRST fill in cell " & Cell.Address(0, 0)
    Application.Goto Cell
    Cancel = True
    allIsWell = False
    End If

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    How are you calling the macro? Are you including the code in the Worksheet_Change event, or calling it manually?

  3. #3
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    Hi,

    i'm using the following as it checks the formatting and stops the save if a certain cell has condtional formatting in it;

    Private Sub WorkBOOK_BeforeSave(ByVal SaveAsUI As Boolean, _
    Cancel As Boolean)

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    You might just want to write the conditions directly in VBA in order to accomplish this. Are your conditions different throughout the sheet, or are all conditions the same? What is the range in which you have conditional formatting that the BeforeSave event is checking?
    Last edited by jasoncw; 01-28-2007 at 06:17 PM.

  5. #5
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    Hi,

    the conditional formatting is only applicable in the following range;

    m24:n73

    thanks

+ 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