LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Comparing two dates in one column

I found this piece of code while searching for a way to underline
anytime there is a date change in column A, but it doesnt always
underline correctly and if ran twice it incorrectly underlines rows.
Where is the bug? I can't find it. Any help is appreciated. thanks!

Dim RowNdx As Long
Dim ColNum As Integer

ColNum = Selection(1).Column
Columns("A:A").Select
Application.ScreenUpdating = False

For RowNdx = Selection(Selection.Cells.Count).Row To _
Selection(1).Row + 1 Step -1
If Cells(RowNdx, ColNum).Value < Cells(RowNdx - 1, ColNum).Value
Then
Cells(RowNdx - 1, 1).EntireRow.Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
Next RowNdx

 
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
How to do multiple IF checks with dates AND text RJ Fleener Excel Worksheet Functions 6 October 22nd 06 03:42 AM
Formula help for counting,with a column of dates and a column of n Altstatten Excel Worksheet Functions 2 December 8th 05 09:32 PM
Value between 2 dates AG Excel Worksheet Functions 11 August 21st 05 05:32 PM
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM
Comparing Cells and Displaying Data Keith Brown Excel Worksheet Functions 1 February 9th 05 05:42 PM


All times are GMT +1. The time now is 11:44 PM.

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

About Us

"It's about Microsoft Excel"