Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Help With Finding Date And Copying Everything To The Right OfIt? | Excel Discussion (Misc queries) | |||
Finding, copying and pasting | Excel Programming | |||
Finding and copying from 1 worksheet to another. | Excel Programming | |||
finding names and copying | Excel Programming |