Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Need Help With Finding Date And Copying Everything To The Right OfIt?

Hey Guys,

I am stuck on a problem and would really appreciate some help with it.
I heard this is a good place to look for help. =)

I have sequential dates in Cells C3:IV3, with correlating data for
that date below it.

I need help creating a macro that would look for the first day of the
current week in the range C3:IV3 and once it is found, would copy all
cells to the right of it and paste it into Sheet2. Is this possible?

For example, for today, it would look for the date 4/13 in the range
C3:IV3. It finds that date in cell X3. It then would need to copy
cells X3:IV75 from the current sheet1 into sheet2.

I am having a hard time coming up with the logic for this. I am not an
expert user but need to get this done!! Any help would be greatly
appreciated!!!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Need Help With Finding Date And Copying Everything To The RightOf It?

Here's one way:

Sub test()
dt$ = Format(Int((Now - (Now - 2) Mod 7) - 1), "m/d/yyyy")
With Sheets(1)
Set found = .Range("C3:IV3").Find(What:=dt$, _

LookIn:=xlValues, _
Lookat:=xlWhole)
If Not found Is Nothing Then
lrow = .Cells(.Rows.Count, found.Column).Row
Set rng = .Range(.Cells(3, found.Column), .Cells(lrow, "IV"))
rng.Copy Sheets(2).Range("A3")
Else
MsgBox dt$ & " not found."
End If
End With
End Sub

--
Dan

On Apr 17, 10:47*am, Jenny Marlow wrote:
Hey Guys,

I am stuck on a problem and would really appreciate some help with it.
I heard this is a good place to look for help. =)

I have sequential dates in Cells C3:IV3, with correlating data for
that date below it.

I need help creating a macro that would look for the first day of the
current week in the range C3:IV3 and once it is found, would copy all
cells to the right of it and paste it into Sheet2. Is this possible?

For example, for today, it would look for the date 4/13 in the range
C3:IV3. It finds that date in cell X3. It then would need to copy
cells X3:IV75 from the current sheet1 into sheet2.

I am having a hard time coming up with the logic for this. I am not an
expert user but need to get this done!! Any help would be greatly
appreciated!!!!!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Need Help With Finding Date And Copying Everything To The RightOf It?

Here's one way:

Sub test()
dt$ = Format(Int((Now - (Now - 2) Mod 7) - 1), "m/d/yyyy")
With Sheets(1)
Set found = .Range("C3:IV3").Find(What:=dt$, _
LookIn:=xlValues, _
Lookat:=xlWhole)
If Not found Is Nothing Then
lrow = .Cells(.Rows.Count, found.Column).End(xlUp).Row
Set rng = .Range(.Cells(3, found.Column), .Cells(lrow, "IV"))
rng.Copy Sheets(2).Range("A3")
Else
MsgBox dt$ & " not found."
End If
End With
End Sub

--
Dan


On Apr 17, 10:47*am, Jenny Marlow wrote:
Hey Guys,

I am stuck on a problem and would really appreciate some help with it.
I heard this is a good place to look for help. =)

I have sequential dates in Cells C3:IV3, with correlating data for
that date below it.

I need help creating a macro that would look for the first day of the
current week in the range C3:IV3 and once it is found, would copy all
cells to the right of it and paste it into Sheet2. Is this possible?

For example, for today, it would look for the date 4/13 in the range
C3:IV3. It finds that date in cell X3. It then would need to copy
cells X3:IV75 from the current sheet1 into sheet2.

I am having a hard time coming up with the logic for this. I am not an
expert user but need to get this done!! Any help would be greatly
appreciated!!!!!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Need Help With Finding Date And Copying Everything To The Right Of

MyDate = DateValue("4/17/08")
FirstDay = MyDate - Weekday(MyDate) + 1
With Sheets("Sheet1")
For Each cell In .Range("3:3")
If cell.Value = FirstDay Then
.Range(cell, .Cells(3, Columns.Count)).Copy _
Destination:=Sheets("sheet2").Range("A1")
End If
Next cell
End With

"Jenny Marlow" wrote:

Hey Guys,

I am stuck on a problem and would really appreciate some help with it.
I heard this is a good place to look for help. =)

I have sequential dates in Cells C3:IV3, with correlating data for
that date below it.

I need help creating a macro that would look for the first day of the
current week in the range C3:IV3 and once it is found, would copy all
cells to the right of it and paste it into Sheet2. Is this possible?

For example, for today, it would look for the date 4/13 in the range
C3:IV3. It finds that date in cell X3. It then would need to copy
cells X3:IV75 from the current sheet1 into sheet2.

I am having a hard time coming up with the logic for this. I am not an
expert user but need to get this done!! Any help would be greatly
appreciated!!!!!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need Help With Finding Date And Copying Everything To The Right OfIt?

Check your other post, too.

Jenny Marlow wrote:

Hey Guys,

I am stuck on a problem and would really appreciate some help with it.
I heard this is a good place to look for help. =)

I have sequential dates in Cells C3:IV3, with correlating data for
that date below it.

I need help creating a macro that would look for the first day of the
current week in the range C3:IV3 and once it is found, would copy all
cells to the right of it and paste it into Sheet2. Is this possible?

For example, for today, it would look for the date 4/13 in the range
C3:IV3. It finds that date in cell X3. It then would need to copy
cells X3:IV75 from the current sheet1 into sheet2.

I am having a hard time coming up with the logic for this. I am not an
expert user but need to get this done!! Any help would be greatly
appreciated!!!!!!


--

Dave Peterson
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
Need Help With Finding Date And Copying Everything To The Right OfIt? Jenny Marlow Excel Discussion (Misc queries) 4 April 17th 08 09:37 PM
Finding, copying and pasting [email protected] Excel Programming 1 March 28th 08 11:44 AM
Finding and copying from 1 worksheet to another. aintlifegrand79 Excel Programming 0 March 10th 08 03:39 PM
finding names and copying Bob Phillips[_6_] Excel Programming 0 March 3rd 04 05:49 PM


All times are GMT +1. The time now is 05:03 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"