Excel 2003 Macro - Finding rows with data to copy

  • Follow


Below is a recorded macro to copy data to another worksheet. 

Range("V7").Select
    Selection.AutoFilter Field:=20, Criteria1:="<>"
    Range("V7:AI7").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("V7:AS350").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Combined Upload File").Select
    Range("A3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, 
SkipBlanks _
        :=False, Transpose:=False

What I really need to do is find the first row that has data in column V (do 
not want to include the headers) and go to the last row that has data, copy 
and paste into another worksheet.  There is a formula in column V that will 
provide results if the criteria is met.  The current range where there is a 
possiblity of data is from V7-V350.  I could have data populated in V7 but 
not necessarily.  I originally was filtering by "non blanks" to get the data 
I wanted to copy but realized that it is not dynamic and will not change each 
day based on what rows will have data or not.
-- 
Debbie Sherman
0
Reply Utf 3/23/2010 1:09:01 PM

      If desired, send your file to my address below. I will only look if:
      1. You send a copy of this message on an inserted sheet
      2. You give me the newsgroup and the subject line
      3. You send a clear explanation of what you want
      4. You send before/after examples and expected results.


-- 
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett@gmail.com
"Debbie" <Debbie@discussions.microsoft.com> wrote in message 
news:C9FD8AFB-0E84-4E1A-A0F5-54F9B650D8BC@microsoft.com...
> Below is a recorded macro to copy data to another worksheet.
>
> Range("V7").Select
>    Selection.AutoFilter Field:=20, Criteria1:="<>"
>    Range("V7:AI7").Select
>    Range(Selection, Selection.End(xlToRight)).Select
>    Range("V7:AS350").Select
>    Application.CutCopyMode = False
>    Selection.Copy
>    Sheets("Combined Upload File").Select
>    Range("A3").Select
>    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
>        :=False, Transpose:=False
>
> What I really need to do is find the first row that has data in column V 
> (do
> not want to include the headers) and go to the last row that has data, 
> copy
> and paste into another worksheet.  There is a formula in column V that 
> will
> provide results if the criteria is met.  The current range where there is 
> a
> possiblity of data is from V7-V350.  I could have data populated in V7 but
> not necessarily.  I originally was filtering by "non blanks" to get the 
> data
> I wanted to copy but realized that it is not dynamic and will not change 
> each
> day based on what rows will have data or not.
> -- 
> Debbie Sherman 

0
Reply Don 3/23/2010 1:23:54 PM


1 Replies
688 Views

(page loaded in 0.097 seconds)


Reply: