try this

Sub cop_dates()

On Error Resume Next
Sheets("ATS Data").UsedRange.Clear

Dim i As Long
Dim dt As Date

dt = #4/16/2013#

Sheets("Raw ATS Data").Range("a1:s1").Copy Destination:=Sheets("ATS
Data").Range("a1")

For i = 2 To Sheets("Raw ATS Data").Range("a1048576").End(xlUp).Row

    If Sheets("Raw ATS Data").Range("b" & i).Value = "" Then
        Sheets("Raw ATS Data").Range("a" & i & ":s" & i).Copy
Destination:=Sheets("ATS Data").Range("a1048576").End(xlUp).Offset(2, 0)
    End If

    If Sheets("Raw ATS Data").Range("b" & i).Value >= dt - 10 And
Sheets("Raw ATS Data").Range("b" & i).Value <= dt Then
        Sheets("Raw ATS Data").Range("a" & i & ":s" & i).Copy
Destination:=Sheets("ATS Data").Range("a1048576").End(xlUp).Offset(1, 0)
    End If


Next

Sheets("ATS Data").UsedRange.Columns.AutoFit

End Sub



see if it helps


On Mon, Oct 14, 2013 at 7:06 PM, Justin Pulley <[email protected]>wrote:

> It is somehow attached to the first post in the thread, you'd have to
> expand all threads to see it.
>
> On Saturday, October 12, 2013 7:36:09 AM UTC-7, ashish wrote:
>>
>> attachment is missing
>>
>>
>> On Fri, Oct 11, 2013 at 3:48 AM, Justin Pulley <[email protected]>wrote:
>>
>>> Was the attached file what you were looking for?
>>>
>>>
>>> On Thursday, October 10, 2013 8:44:55 AM UTC-7, ashish wrote:
>>>
>>>> can u pls share a sample workbook?
>>>>
>>>>
>>>> On Thu, Oct 10, 2013 at 9:05 PM, Justin Pulley <[email protected]>wrote:
>>>>
>>>>> Here is my current code:
>>>>>
>>>>>  Code:
>>>>>
>>>>> Dim sh As Worksheet, sh2 As Worksheet
>>>>> Dim LastRow As Integer
>>>>> Dim LastRow2 As Integer
>>>>>
>>>>> Set sh = Sheets("Raw ATS Data")
>>>>> Set sh2 = Sheets("ATS Data")
>>>>>
>>>>> With sh2
>>>>>     Range("A2:H" & Rows.Count).Clear
>>>>> End With
>>>>>
>>>>> LastRow = sh.Range("A1").End(xlDown).Row
>>>>> sh.Range("A1:H" & LastRow).Copy
>>>>> sh2.Range("A1").PasteSpecial xlPasteAll
>>>>> sh2.Range("A1").PasteSpecial xlPasteColumnWidths
>>>>>
>>>>> LastRow2 = sh2.Range("A1").End(xlDown).**Ro**w
>>>>> Range("A1:H" & LastRow2).Select
>>>>> Selection.Rows.AutoFit
>>>>>
>>>>> Application.CutCopyMode = False
>>>>> Application.DisplayAlerts = False
>>>>> /code
>>>>>
>>>>> I need to modify this so that it looks at the date from the "Power
>>>>>  Report" sheet in cell O1 and then finds all the dates within the last
>>>>> 14 days from  the sh sheet in column B (row 2 and on) and then performs
>>>>> the copy on only those rows within that date criteria.  Row 1 contains
>>>>> the data headers.  There are also categories separator rows which always 
>>>>> contain the same names ("Static Drop", "Back Feed Drop", "Flip Failure", 
>>>>> and "Peripheral Drop")
>>>>>                                           
>>>>> so it looks like
>>>>>
>>>>> Row 1 - Headers
>>>>>
>>>>> Row 2 - Separator w/ label
>>>>>
>>>>> Row 3 - x (current row 36) data
>>>>>
>>>>> Row 37 (currently) - Separator w/ label
>>>>>
>>>>> Row 38 - 43 - data
>>>>>
>>>>> Row 44 (Currently) - Separator w/ label
>>>>>
>>>>> Row 45 - Data
>>>>>
>>>>> I will be adding data to this until the end of the year and then 
>>>>> archiving it.  So I need a macro that is fluid enough to Always copy the 
>>>>> separators and then only the data that has the date as mentioned.
>>>>>
>>>>> my VBA skills are somewhat new and I am struggling with the best way to 
>>>>> implement what I want to do.  I considered a Match function that looked 
>>>>> at the date and then determined if it was within the last 14 days, or an 
>>>>> ElseIf type of implementation, or a Do Until.  Just need a hand with the 
>>>>> most efficient way to modify the code and make it work.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  --
>>>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be?
>>>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>>>>> https://www.facebook.com/**discu**ssexcel<https://www.facebook.com/discussexcel>
>>>>>
>>>>> FORUM RULES
>>>>>
>>>>> 1) Use concise, accurate thread titles. Poor thread titles, like
>>>>> Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need
>>>>> Advice will not get quick attention or may not be answered.
>>>>> 2) Don't post a question in the thread of another member.
>>>>> 3) Don't post questions regarding breaking or bypassing any security
>>>>> measure.
>>>>> 4) Acknowledge the responses you receive, good or bad.
>>>>> 5) Jobs posting is not allowed.
>>>>> 6) Sharing copyrighted material and their links is not allowed.
>>>>>
>>>>> NOTE : Don't ever post confidential data in a workbook. Forum owners
>>>>> and members are not responsible for any loss.
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "MS EXCEL AND VBA MACROS" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to excel-macros...@**googlegroups.**com.
>>>>> To post to this group, send email to [email protected].
>>>>>
>>>>> Visit this group at 
>>>>> http://groups.google.com/**group**/excel-macros<http://groups.google.com/group/excel-macros>
>>>>> .
>>>>> For more options, visit 
>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Regards*
>>>> * *
>>>> *Ashish Koul*
>>>>
>>>>
>>>> *Visit*
>>>> *My Excel Blog <http://www.excelvbamacros.com/>*
>>>> Like Us on 
>>>> Facebook<http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
>>>> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>
>>>>
>>>>
>>>> P Before printing, think about the environment.
>>>>
>>>>
>>>>
>>>  --
>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be?
>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
>>> https://www.facebook.com/**discussexcel<https://www.facebook.com/discussexcel>
>>>
>>> FORUM RULES
>>>
>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>>> will not get quick attention or may not be answered.
>>> 2) Don't post a question in the thread of another member.
>>> 3) Don't post questions regarding breaking or bypassing any security
>>> measure.
>>> 4) Acknowledge the responses you receive, good or bad.
>>> 5) Jobs posting is not allowed.
>>> 6) Sharing copyrighted material and their links is not allowed.
>>>
>>> NOTE : Don't ever post confidential data in a workbook. Forum owners and
>>> members are not responsible for any loss.
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "MS EXCEL AND VBA MACROS" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to excel-macros...@**googlegroups.com.
>>> To post to this group, send email to [email protected].
>>> Visit this group at 
>>> http://groups.google.com/**group/excel-macros<http://groups.google.com/group/excel-macros>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>
>>
>>
>> --
>> *Regards*
>> * *
>> *Ashish Koul*
>>
>>
>> *Visit*
>> *My Excel Blog <http://www.excelvbamacros.com/>*
>> Like Us on 
>> Facebook<http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
>> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>
>>
>>
>> P Before printing, think about the environment.
>>
>>
>>
>  --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Regards*
* *
*Ashish Koul*


*Visit*
*My Excel Blog <http://www.excelvbamacros.com/>*
Like Us on 
Facebook<http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>


P Before printing, think about the environment.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to