+ Reply to Thread
Results 1 to 3 of 3

Need sample code

Hybrid View

  1. #1
    Sandy
    Guest

    Need sample code

    Hello -

    I need sample code for the following scenarios:

    If the color of the cell in column G is light green, then issue an error
    message.
    If the color of the cell in column G is white, make sure the corresponding
    cell in column I is also white.

    If there is a formula in the cell in column G, issue an error message.
    If there is a Yes, No, or N/A in column G, make sure the corresponding cell
    in Column I has text in it.

    Any help will be greatly appreciated!

    --
    Sandy

  2. #2
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316
    Sub CheckIt()

    For each c in Range("g:g")
    If c.interior.color= vbgreen then
    MsgBox "Error-Greenland"
    If c.interior.color=vbWhite then
    c.offset(1,0).interior.color=vbwhite
    If c.SpecialCells(xlCellTypeFormulas) then
    Msgbox "Error-Formula!"
    If c.SpecialCells(xlCellTypeFormulas,xlErrors) or _ c.SpecialCells(xlCellTypeFormulas,xlLogical)then
    If c.offset(1,0).SpecialCells(xlCellTypeFormulas,xlText) =false or
    SpecialCells(xlCellTypeConstants,xlText)=False
    MsgBox "Text required"
    End if
    End if
    End if
    End if
    Next

    End Sub

  3. #3
    Sandy
    Guest

    Re: Need sample code

    Hello David -

    Thank you so much!!!
    --
    Sandy


    "davidm" wrote:

    >
    > Sub CheckIt()
    >
    > For each c in Range("g:g")
    > If c.interior.color= vbgreen then
    > MsgBox "Error-Greenland"
    > If c.interior.color=vbWhite then
    > c.offset(1,0).interior.color=vbwhite
    > If c.SpecialCells(xlCellTypeFormulas) then
    > Msgbox "Error-Formula!"
    > If c.SpecialCells(xlCellTypeFormulas,xlErrors) or _
    > c.SpecialCells(xlCellTypeFormulas,xlLogical)then
    > If c.offset(1,0).SpecialCells(xlCellTypeFormulas,xlText) =false or
    > SpecialCells(xlCellTypeConstants,xlText)=False
    > MsgBox "Text required"
    > End if
    > End if
    > End if
    > End if
    > Next
    >
    > End Sub
    >
    >
    > --
    > davidm
    > ------------------------------------------------------------------------
    > davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
    > View this thread: http://www.excelforum.com/showthread...hreadid=400669
    >
    >


+ 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