Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop through a range
Hello NG,
I'm trying to compare two columns of numbers to see if there are new entries in the list. I have a column of numbers (always in E) and I have another column of numbers (always in J). The numbers in column E are the numbers for invoices I've already checked, the numbers in column J are for the numbers of invoices that are both new and checked. How can I compare the 2 columns and change the font color to red for the new invoice numbers (invoices not checked) . I have gotten this far and I don't know how to continue Any help would be greatly appreciated James ============================================= Sub Check_Invoice_Number() Sheets("Sheet1").Activate Dim i As Integer Dim RowCount As Integer Dim CellVaLue Application.ScreenUpdating = False 'get the number of rows from the first column for the loop (column E) Range("E65536").Select Selection.End(xlUp).Select Range(Selection, Selection.End(xlUp)).Select RowCount = Selection.Rows.Count 'define a starting place Range("E1").Select 'Begining of Loop---------------------------------------------------------------------------- 'Loop through each of the rows of the spreadsheet For i = 1 To RowCount ' look in column E, which is the 1st column for a duplicate If (Cells(i + 1).Value) = (testvalue for column J) Then CellVaLue = ActiveCell.Value MsgBox CellVaLue Else CellVaLue = ActiveCell.Value MsgBox CellVaLue End If Next End Sub -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop through a range
select Column J (J1 should be the activeCell), then do Format, Conditional
Formatting in the dialog, change Cell value is to Formula is in the textbox put =countif($E:$E,J1)=0 then click the format button and pattern tab, pick red. then OK out. -- Regards, Tom Ogilvy "James" wrote in message ... Hello NG, I'm trying to compare two columns of numbers to see if there are new entries in the list. I have a column of numbers (always in E) and I have another column of numbers (always in J). The numbers in column E are the numbers for invoices I've already checked, the numbers in column J are for the numbers of invoices that are both new and checked. How can I compare the 2 columns and change the font color to red for the new invoice numbers (invoices not checked) . I have gotten this far and I don't know how to continue Any help would be greatly appreciated James ============================================= Sub Check_Invoice_Number() Sheets("Sheet1").Activate Dim i As Integer Dim RowCount As Integer Dim CellVaLue Application.ScreenUpdating = False 'get the number of rows from the first column for the loop (column E) Range("E65536").Select Selection.End(xlUp).Select Range(Selection, Selection.End(xlUp)).Select RowCount = Selection.Rows.Count 'define a starting place Range("E1").Select 'Begining of Loop------------------------------------------------------------------------ ---- 'Loop through each of the rows of the spreadsheet For i = 1 To RowCount ' look in column E, which is the 1st column for a duplicate If (Cells(i + 1).Value) = (testvalue for column J) Then CellVaLue = ActiveCell.Value MsgBox CellVaLue Else CellVaLue = ActiveCell.Value MsgBox CellVaLue End If Next End Sub -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
For Each Loop w/ a range | Excel Programming | |||
loop in range | Excel Programming | |||
Loop in a Range | Excel Programming | |||
Loop through a range | Excel Programming | |||
Changing range name in loop | Excel Programming |