View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
[email protected] jay@penitentyanks.com is offline
external usenet poster
 
Posts: 5
Default Sporadic Error Copying Sheets from one workbook to another

Thank you for your suggestions. I responded to you earlier, but my
response didn't show up in the forum, for some reason.
I'm adding in the log function at this time - thank you for the code
for that.

I've also changed the reference to the external sheets. Your idea on
the const for the rest of the new sheet name is a good idea.

As for your question - the other user is not getting an error message
- the routine simply pastes the variance data into the financial
statement page, instead of the variance sheet.


Note that I added in the LogIt Sub that you sent me, and I'm getting
the following error:
"Run Time Error: '1004'. Select Method of Range class failed.
At this line:
ThisWorkbook.Worksheets("LogSheet").Range("A1").Se lect

Any ideas?




On May 2, 10:17 am, JLatham <HelpFrom @ Jlathamsite.com.(removethis)
wrote:
Where I see a potential for error/confusion is where you use an index number
to reference a worksheet, as .Sheets(1) and .Sheets(2). Since you seem to
know the name of those sheets, you may want to reference them specifically.

I'm assuming that other things we don't see defined here, as Model , FSName
and FSLocation are defined elsewhere since things apparently are working
earlier in the code where they are used.

I notice you have one .Unprotect line commented out - intentional? Same for
one .Move sheet statement. Rhetorical questions.

Finally, are the users actually getting any error messages at any time or
are things "just not working" without any real error indication given to the
user? If they aren't getting error messages, unless somewhere in you have an
On Error Resume Next statement, then that would mean that the operations
requested are being performed - they just are not being performed from/on the
places you think they should be.

You could try to track things down by adding a sheet to the book with the
code in it, call it LogSheet. Somewhere near the beginning of all of this
processing, or a little ahead of where you think the problem is, you can
start logging what the code is doing and look at that log sheet when things
don't go right - just have the other person copy that sheet to a separate
workbook and email it to you or even send you the complete file. Then you
can look and see exactly what Excel was doing.

Here's a snippet from your code with some lines added to show how to do
this. with the LogIt(LogEvent as String) sub that I've set up. Needs a sheet
in that workbook named "LogSheet", obviously. Be generous in the information