View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default code back to worksheet


It is looking at each sheet you named in the array
it is looking down col a for any value not equal to 1
When found those values are copied to the next available row in sheet1
Try it

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"project manager" wrote in
message ...
not too sure i get this, could you put a couple of notes to show what it
does
at the major sections?

thanks

"Don Guillett" wrote:

You should ALWAYS post your code for comments but you may like this idea.

Sub foreachwsinarray()
myarray = Array("sheet2", "sheet3")
For Each sh In myarray

For Each c In Sheets(sh).Range("a2:a22")

With Sheets("sheet1")

If c < 1 Then
lr = .Cells(Rows.Count, 1).End(xlUp).Row + 1
c.EntireRow.Copy .Cells(lr, 1)
End If

End With
Next c

Next sh
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"project manager" wrote in
message ...
I have written some code which goes through a series of worksheets which
are
all the same except the name is different peoples intials. The code
opens
each sheet and highlights the errors, I am trying to copy these errors
into a
summary/report sheet. The code goes through each row and when it finds
an
error jumps into the copying sub.

I have got the code copying the errors into a report template sheet but
can't get the code to jump back into the previously active worksheet,
where
the data/errors have been copied from to carry on looking for more
errors
and
go through other sheets.

once it finds an error... (i know there's errors in the code only
rough/
quick)

Range("A" & i : "L" & i).select
Copy.selecction
Call report

sheets("summary").select
-code to find the last row-
paste.selection
-now go back to last active sheet???-

Any help?