View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
brentm brentm is offline
external usenet poster
 
Posts: 35
Default Copy data from one tab to another based on cell value on one

Stephen,

Thanks for your help. I went a different route, but your help got me
started. Thanks.

Brent

"Stephen Lloyd" wrote:

I haven't tested this, but I think it will put you on the right track.

Sub FindWorksheet()

Dim wb As workbook
Dim wsInv As worksheet
Dim wslookup As worksheet
Dim rDate As range

Set wb = Activeworkbook
Set wsInv = wb.Worksheets("Invoice")
Set rDate = wsInv.Range("C10")

For Each wslookup in wb.Worksheets
If rDate.Value <= CDate(wslookup.Name) And rDate.Value
CDate(wslookup.Name)-7 Then
'Enter Code to pull information
End If
Next wslookup

End Sub

"brentm" wrote:

I have a spreadsheet where each tab represents 1 week. the tabs are named
based on the week ending date that tab covers - "June 25", "July 2", etc.
There is a master tab named "Invoice" with the period ending date residing in
cell C10. Is there a way I can have a macro go to the appropriate tab based
on the date entered in C10 on the "Invoice" tab? I need the macro to copy
over specific information, which I can do, but I wanted the macro to
automatically look at the value in C10 on "Invoice", then go get the
information from the appropriate tab that corrosponds to that cell value.
Anyone have any ideas?