Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
For Each Loop w/ a range xlcharlie Excel Programming 3 April 8th 05 07:43 PM
loop in range Aksel Børve Excel Programming 3 March 9th 05 02:30 PM
Loop in a Range aksel børve Excel Programming 2 March 8th 05 06:40 PM
Loop through a range Fred[_21_] Excel Programming 6 October 22nd 04 10:45 PM
Changing range name in loop Jeff Excel Programming 4 July 12th 04 08:32 PM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"