Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default VBA Code to find the Row Number of the last repeated row of aparticular date field



I have this Table where the first field is a Date Field where the dates are repeated.


Column A

1 14-Aug-2016
2 14-Aug-2016
3 15-Aug-2016
4 15-Aug-2016
5 15-Aug-2016
6 17-Aug-2016
7 17-Aug-2016
8 17-Aug-2016
9 17-Aug-2016
10 17-Aug-2016
11 17-Aug-2016
12 18-Aug-2016
13 19-Aug-2016
14 19-Aug-2016

I need to write a code to get the Row Number of the last repeated Row of a particular date, say for 14-Aug-2016 it would be Row No. 2, for 17-Aug-2016, it is Row No.9...


Help please

San
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default VBA Code to find the Row Number of the last repeated row of a particular date field

Hi,

Am Tue, 30 Aug 2016 21:39:21 -0700 (PDT) schrieb shriil:

1 14-Aug-2016
2 14-Aug-2016
3 15-Aug-2016
4 15-Aug-2016
5 15-Aug-2016
6 17-Aug-2016
7 17-Aug-2016
8 17-Aug-2016
9 17-Aug-2016
10 17-Aug-2016
11 17-Aug-2016
12 18-Aug-2016
13 19-Aug-2016
14 19-Aug-2016


try:

Sub Test()
Dim LRow As Long

On Error GoTo skip
With Application
LRow = .Match(Range("G1"), Range("A:A"), 0) + .CountIf(Range("A:A"),
Range("G1")) - 1
End With
MsgBox LRow
skip:
MsgBox "No matches found"
End Sub


Regards
Claus B.
--
Windows10
Office 2016
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default VBA Code to find the Row Number of the last repeated row of aparticular date field

On Wednesday, August 31, 2016 at 10:09:28 AM UTC+5:30, shriil wrote:
I have this Table where the first field is a Date Field where the dates are repeated.


Column A

1 14-Aug-2016
2 14-Aug-2016
3 15-Aug-2016
4 15-Aug-2016
5 15-Aug-2016
6 17-Aug-2016
7 17-Aug-2016
8 17-Aug-2016
9 17-Aug-2016
10 17-Aug-2016
11 17-Aug-2016
12 18-Aug-2016
13 19-Aug-2016
14 19-Aug-2016

I need to write a code to get the Row Number of the last repeated Row of a particular date, say for 14-Aug-2016 it would be Row No. 2, for 17-Aug-2016, it is Row No.9...


Help please

San


Thanks. Will try it out.

San
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
Count of times a number is repeated by date? bjkeyt Excel Worksheet Functions 2 April 7th 08 09:30 PM
Find and Add a number in a text field dereksmom Excel Worksheet Functions 1 June 26th 07 02:34 PM
Lookup to find the last value based on name and date field Adam Thwaites Excel Discussion (Misc queries) 4 April 4th 07 05:15 PM
How can i calculate the age as on aparticular date on excel Faihas Excel Worksheet Functions 1 May 6th 06 06:53 AM
Trying to SUM up a DATE/TIME field in code... Rone[_2_] Excel Programming 0 March 15th 06 11:20 PM


All times are GMT +1. The time now is 09:42 AM.

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

About Us

"It's about Microsoft Excel"