View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jason Morin[_4_] Jason Morin[_4_] is offline
external usenet poster
 
Posts: 1
Default Find date and copy range based on that date

Not perfect, but should get you started:

Sub test()
Dim irow As Long
Dim ival As Range, icol As Range
Dim idesta As Range

Set ival = Sheets("Sheet2").Range("F1")
Set icol = Sheets("Sheet2").Range("A:A")
Set idest = Sheets("Sheet3").Range("A1")

irow = 0
On Error Resume Next
irow = Application.WorksheetFunction. _
Match(ival, icol, 0)
On Error GoTo 0

If irow < 0 Then
Range("A" & irow).Resize(5, 6).Copy (idest)
Else
MsgBox ival & " not found."
End If

End Sub

---

F1 contains the value to look for, and the "other
location" to copy to is Sheet3!A1.

HTH
Jason
Atlanta, GA

-----Original Message-----

Hi,

I'd like to have a VBA routine who does the following:

- Look in a cell what date is stored in it.
- Find that date in a very large column 'A'.
- Select the found date in column 'A' together with the

next 5 columns
and 5 rows down.
- Copy this range to another location.

Please, respond.


--
avzundert
---------------------------------------------------------

---------------
avzundert's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=16808
View this thread:

http://www.excelforum.com/showthread...hreadid=320171

.