No, the button being on another sheet is not the problem because you
adequately reference the other sheet. Do this.
Write a new macro like this:
Sub Test()
MsgBox "Page1 is: " & Len(Sheets("Page1").Name)
MsgBox "Page2 is: " & Len(Sheets("Page2").Name)
End Sub
The 2 message boxes will tell you the number of characters in the names of
the 2 sheets as they are written in the sheet tabs.
Now look at the same sheet names in your macro code and see if those names
have the same number of characters as in the sheet tabs. Sometimes a space
here and there is overlooked and causes this problem.
If that's not the problem, do this:
Open a new blank file. In that new file name two of the sheets the same as
in the problem file. Write a macro within that new file with just those two
lines that you posted in your original posting. Make sure that you get the
same error as before. If you do, send me that file via email. My email
address is ottokmnop@comcast.net. Remove the "nop" from this address. HTH
Otto
When I debug my code it highlights the line
B = Worksheets("Page2").Range("I8").Value
and tells me that the index is out of bound. It seems like the second
worksheet in my workbook is not reachable. I have tried to put this two
lines separate in a new macro but I get the same error. Maybe it´s
because the button I have created in excel is on another worksheet?
emma - 28 Dec 2005 20:38 GMT
I found the error and the code is now working!
Thank you for your help
I appreciate it!
/Emma
Otto Moehrbach - 28 Dec 2005 22:09 GMT
Please post what you found. It would help the many people who look at these
newsgroups. Otto
>I found the error and the code is now working!
> Thank you for your help
> I appreciate it!
> /Emma