Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JDB JDB is offline
external usenet poster
 
Posts: 42
Default Copy Data to a new sheet

Hi,

I am trying to copy data to a new sheet and having some problems.

I need to copy all passes and faileds to a new sheet and work out the
percentage.

Column R contains whether the item is a "Pass" or "Fail" and is
automatically filled in by the formula
=IF(OR(D3="Y",I3="Y",J3="Y",P3="Y",Q3="Y"),"Pass", "Fail").

I have the following code copied from elsewhere on this site, but it does
not work. Returns the message "There are no items to move."!

Also, once complete, how do I assign the macro to a button on the toolbar?

Any help would be gratefully received as it would automate a very laborious
task!

JDB.
  #2   Report Post  
Posted to microsoft.public.excel.programming
JDB JDB is offline
external usenet poster
 
Posts: 42
Default Copy Data to a new sheet

Oops! The code would have helped!

Sub MoveStuff()
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngPaste As Range
Dim strFirstAddress As String

Set rngPaste = Sheets("Results").Cells(Rows.Count,
"A").End(xlUp).Offset(1, 0)
Set rngToSearch = ActiveSheet.Columns("R")
Set rngFound = rngToSearch.Find(What:="Pass", LookIn:=xlFormulas,
LookAt:=xlWhole, MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "There are no items to move."
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress

rngFoundAll.EntireRow.Copy Destination:=rngPaste
End If


End Sub



"JDB" wrote:

Hi,

I am trying to copy data to a new sheet and having some problems.

I need to copy all passes and faileds to a new sheet and work out the
percentage.

Column R contains whether the item is a "Pass" or "Fail" and is
automatically filled in by the formula
=IF(OR(D3="Y",I3="Y",J3="Y",P3="Y",Q3="Y"),"Pass", "Fail").

I have the following code copied from elsewhere on this site, but it does
not work. Returns the message "There are no items to move."!

Also, once complete, how do I assign the macro to a button on the toolbar?

Any help would be gratefully received as it would automate a very laborious
task!

JDB.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Excel Discussion (Misc queries) 2 May 15th 10 06:49 AM
copy data of two cells from Sheet 2 into one cell in Sheet 1 cahabbinga Excel Worksheet Functions 6 January 30th 08 01:00 PM
How can i copy data from a tabbed working sheet to a summary sheet StephenF Excel Discussion (Misc queries) 1 March 15th 07 03:40 PM
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 parag Excel Worksheet Functions 3 June 15th 06 10:29 PM
Copy data from sheet 1 to sheet 2 based on day/date [email protected] Excel Programming 7 October 1st 05 04:59 PM


All times are GMT +1. The time now is 08:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"