Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Alright. This bit of code is not working. I should note that the NewProject
and Compare values are a variable of two letters followed by numbers. I am trying to match these and then notify the user by marking the cells red. I think there may a problem with the double loop, but I can't tell. I get red cells. I even get looping. In reality the contents of the cells are two different numbers even though the msgbox that you see below gives the cell contents as identical and the cell position correctly. Dim NC1 As Integer Dim NewProject As Variant Dim Compare As Variant Dim LC1 As Integer Dim i As Integer Dim j As Integer Windows(NameWorksheet & ".xls").Activate Sheets("Estimated - BA Approved").Select NC1 = Cells(Rows.Count, 1).End(xlUp).Row If NC1 = 2 Then MsgBox ("There are no projects on this page.") GoTo STOP1 Else Windows(NameWorksheet & ".xls").Activate Sheets("Estimated - BA Approved").Select For i = 3 To NC1 NewProject = Range("A" & i).Value Windows(OldWorksheet & ".xls").Activate Sheets("Estimated - BA Approved").Select LC1 = Cells(Rows.Count, 1).End(xlUp).Row For j = 3 To LC1 Compare = Range("A" & j).Value If NewProject = Compare Then Range("A" & j).Interior.Color = RGB(255, 0, 0) Windows(NameWorksheet & ".xls").Activate Sheets("NOT Estimated - BA NOT Approved").Select Range("A" & i).Interior.Color = RGB(255, 0, 0) MsgBox ("This project, " & NewProject & ", A" & i & " has been found in the old project list" & Compare & " , A" & j & ". The cell in the old project list is colored red. Please fix this problem and run this program again. This program finds one duplicate project at a time.") Exit Sub Else End If Next j Next i End If |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting Madness | Excel Discussion (Misc queries) | |||
Formula Madness | Excel Discussion (Misc queries) | |||
Multimodal Madness | Excel Worksheet Functions | |||
VBA Names madness | Excel Programming | |||
More Macro Madness | Excel Programming |