Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to save rows that match a certain criteria to a new worksheet. When I
complete the task, I want to save that worksheet to a file. I create the worksheet like this: Set new_xls = Worksheets.Add new_xls.Move after:=Worksheets(Worksheets.Count) The move is to put it at the end of the workbook, though I suppose I could have done it in a single line of code when I created it. The problem I have is that when I select the data and copy it only works the first time through the loop. I get an appication error the second time I paste. (The first time things seem to work properly. For Each qb In qb_range If qb.Offset(0, 13) rav_rat Then better = better + 1# qb.EntireRow.Copy ActiveSheet.Paste Destination:=new_xls.Cells(1, Int(better)) If qb_list = "" Then qb_list = qb_list & Mid(qb.Value, 1, Len(qb.Value) - 7) & vbCrLf Else qb_list = qb_list & " &" & Mid(qb.Value, 1, Len(qb.Value) - 7) & vbCrLf End If Else worse = worse + 1# End If Next qb What am I doing wrong? Thanks, David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy selected rows to second worksheet (NOT Cut + Paste) | New Users to Excel | |||
Copy a selected number of rows | Excel Discussion (Misc queries) | |||
Is it possible to copy only selected items to another worksheet... | Excel Worksheet Functions | |||
copy selected rows to new sheet | Excel Programming | |||
Macro to copy and past selected rows only... | Excel Programming |