+ Reply to Thread
Results 1 to 2 of 2

need help

  1. #1
    Registered User
    Join Date
    04-15-2006
    Posts
    1

    need help

    there are 3 columns in my excel worksheet. some cells in the first two columns are red in color. these cells match. i want to select the cells in the third column corresponding to these red cells in the first two columns and make them red too. after this i want to select all the cells which are not red in color in these three columns and make a new worksheet out of them.
    Can someone help?

  2. #2
    JMB
    Guest

    RE: need help

    Is this along the lines of what you're looking for? I'm assuming your first
    two columns are A and B. If both of those cells are red (interior color, not
    font color) then it will change the cell in the third column red also. The
    second macro will copy anything that does not have a red interior to a new
    worksheet. Both macros require you to select the third column before running.


    Sub test1()
    Dim x As Range

    For Each x In Intersect(Selection, _
    Selection.Parent.UsedRange)
    If Cells(x.Row, "A").Interior.ColorIndex = 3 And _
    Cells(x.Row, "B").Interior.ColorIndex = 3 Then _
    x.Interior.ColorIndex = 3
    Next x

    End Sub


    Sub test2()
    Dim CopyRange As Range
    Dim x As Range

    For Each x In Intersect(Selection, _
    Selection.Parent.UsedRange)
    If x.Interior.ColorIndex <> 3 Then
    If CopyRange Is Nothing Then
    Set CopyRange = x
    Else: Set CopyRange = Union(CopyRange, x)
    End If
    End If
    Next x

    If Not CopyRange Is Nothing Then _
    CopyRange.Copy Worksheets.Add.Cells(1, 1)

    End Sub


    "bablu" wrote:

    >
    > there are 3 columns in my excel worksheet. some cells in the first two
    > columns are red in color. these cells match. i want to select the cells
    > in the third column corresponding to these red cells in the first two
    > columns and make them red too. after this i want to select all the
    > cells which are not red in color in these three columns and make a new
    > worksheet out of them.
    > Can someone help?
    >
    >
    > --
    > bablu
    > ------------------------------------------------------------------------
    > bablu's Profile: http://www.excelforum.com/member.php...o&userid=33529
    > View this thread: http://www.excelforum.com/showthread...hreadid=533210
    >
    >


+ 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