code back to worksheet

  • Thread starter project manager
  • Start date
P

project manager

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?
 
P

project manager

not too sure i get this, could you put a couple of notes to show what it does
at the major sections?

thanks
 
D

Don Guillett

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
 
J

Jacob Skaria

Use a separate procedure to write the summary and pass the activesheet as an
argument like shown below...I have used your code only...Please try and
feedback

Sub <YourProcedure>
' check
Range("A" & i : "L" & i).select
Copy.selecction
Call WriteSummary(ActiveSheet)
'continue
End Sub


Sub WriteSummary(wsTemp as Worksheet)
'Procedure to write to summary. Source sheet passed as argument
Sheets("summary").select
-code to find the last row-
Paste.selection
-now go back to last active sheet???-
wsTemp.Activate
End Sub


If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top