![]() |
Help me to first row matching First date and last row matching lastrow
Hi,
Column D starting at row 3 contains Dates. This is a dynamic table that grows everyday. Because there will be thousand of rows I need to do some calculations on only some of those rows. In other words I have an initial date and a finish date. (format 2008/01/01) First I am using "TotalBigListCount = SheetSource.UsedRange.Rows.Count" to give the the last row containing data Next I have: With SheetSource.Range("D" & StartRow, "D" & TotalBigListCount) Set c = .Find(DateFromString, LookIn:=xlValues) RowDateCount = c.Row End With This gives me the first row that will match the Initial Date (DateFromString). Pretty simple. Now I would like to do the same to find the last row in the table that matches the DateToString (finish date). Is there an easy way to get it or the only option is to use a do while loop to go thru all the rows until it finds that last match? Thanks |
Help me to first row matching First date and last row matching las
Might be easier to filter by date, but I don't know what you intend to do
after you identify the items so filtering might not fit your plan of attack. " wrote: Hi, Column D starting at row 3 contains Dates. This is a dynamic table that grows everyday. Because there will be thousand of rows I need to do some calculations on only some of those rows. In other words I have an initial date and a finish date. (format 2008/01/01) First I am using "TotalBigListCount = SheetSource.UsedRange.Rows.Count" to give the the last row containing data Next I have: With SheetSource.Range("D" & StartRow, "D" & TotalBigListCount) Set c = .Find(DateFromString, LookIn:=xlValues) RowDateCount = c.Row End With This gives me the first row that will match the Initial Date (DateFromString). Pretty simple. Now I would like to do the same to find the last row in the table that matches the DateToString (finish date). Is there an easy way to get it or the only option is to use a do while loop to go thru all the rows until it finds that last match? Thanks |
Help me to first row matching First date and last row matchinglas
Hi,
Thanks for the help. I need to do it in VBA. This code has to go thru thousands of rows to compare info. So the idea is to shorten the search to narrow it to only the dates specified with StringDateFrom and StringDateTo. Check my post about this : http://groups.google.com/group/micro...9c1e6f651048f1 The code works but it's very slow. |
Help me to first row matching First date and last row matchinglas
Hi,
I think I found a problem. It seems that Set c = .Find(DateFromString, LookIn:=xlValues) only gives a result if there is a match. Which is not what I want. Is there a way for this line to return the closest match as well? Cheers. |
All times are GMT +1. The time now is 04:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com