[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Please Help.....................

bearsfan

12/14/2006 7:26:00 PM

I'm learning alot with using VBA but I also seem to keep encounter new
challenges. I hope someone can help me with this.
I have two dates in two seperate columns and a function that calculates the
days in between them. Based on the number of days in between them, I want to
be able to copy the entire row that is closest to the last day of the month.
Based on the values below, I would be copying the row that contains 1/28/05
because that is closest to 1/31/05. I appreciate your help..........


columna columnb # of days between Col "a" and Col "b"
1/7/2005 1/31/2005 24
1/14/2005 1/31/2005 17
1/21/2005 1/31/2005 10
1/28/2005 1/31/2005 3

2 Answers

Don Guillett

12/14/2006 8:52:00 PM

0

Rows(Application.Match(Range("c1"), Columns("a"), 1)).copy range("x2")

--
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
"bearsfan" <bearsfan@discussions.microsoft.com> wrote in message
news:21A3D777-BE15-4AC4-963C-20E64DC944C3@microsoft.com...
> I'm learning alot with using VBA but I also seem to keep encounter new
> challenges. I hope someone can help me with this.
> I have two dates in two seperate columns and a function that calculates
> the
> days in between them. Based on the number of days in between them, I want
> to
> be able to copy the entire row that is closest to the last day of the
> month.
> Based on the values below, I would be copying the row that contains
> 1/28/05
> because that is closest to 1/31/05. I appreciate your help..........
>
>
> columna columnb # of days between Col "a" and Col "b"
> 1/7/2005 1/31/2005 24
> 1/14/2005 1/31/2005 17
> 1/21/2005 1/31/2005 10
> 1/28/2005 1/31/2005 3
>


Don Guillett

12/14/2006 9:00:00 PM

0

Sub fld()'where 1/31/2005 properly formatted date in c1
Rows(Application.Match(Range("c1"), Columns("a"), 1)).Copy Range("a22")
End Sub

--
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
"bearsfan" <bearsfan@discussions.microsoft.com> wrote in message
news:21A3D777-BE15-4AC4-963C-20E64DC944C3@microsoft.com...
> I'm learning alot with using VBA but I also seem to keep encounter new
> challenges. I hope someone can help me with this.
> I have two dates in two seperate columns and a function that calculates
> the
> days in between them. Based on the number of days in between them, I want
> to
> be able to copy the entire row that is closest to the last day of the
> month.
> Based on the values below, I would be copying the row that contains
> 1/28/05
> because that is closest to 1/31/05. I appreciate your help..........
>
>
> columna columnb # of days between Col "a" and Col "b"
> 1/7/2005 1/31/2005 24
> 1/14/2005 1/31/2005 17
> 1/21/2005 1/31/2005 10
> 1/28/2005 1/31/2005 3
>