PDA

View Full Version : Solved: Infernal 4s



ndendrinos
08-30-2009, 09:57 AM
In this file for an unexplicable reason the card 4 of spades (4s in columns A&B) creates a problem no matter where in range B1:B it happens to be.
Somehow the code cannot find this card although it has been renamed the exact same way as all other cards in the deck.
The fact that 4s is the first shown card in the deck is not the problem (please see area row 9 to 15).
I have deleted the card (both the picture of it and from columns A&B expecting the same error on Picturekc (king of clubs) but that did not happen and kc appears OK.

Can you perhaps indulge me and play with the file until you get the error ... this might take few minutes.
Thank you.
P.S. This does not happen if I use the original name of the cards ... but revising the names to what you see here helps me identify them.
Thank you.

p45cal
08-30-2009, 12:30 PM
Easy, cell A4 contains
"Picture4s " instead of
"Picture4s"

ndendrinos
08-30-2009, 01:38 PM
Hello p45cal.
Not sure what you mean but the picture numbers in columns A&B as well as the name of the card itself are all
Picture4s .... there are no guillemets (French for ") here....
Must be that I misunderstand your reply
Can you elaborate?

p45cal
08-30-2009, 02:27 PM
Cell A4 contains "Picture4s " (without the quotes (guillemets) but with the trailing space).
There's a shape on the sheet called "Picture4s" (without the quotes - and there's no trailing space.
When dealing, this line is executed:
.Offset(0, 1).Value = .Value
which copies the newly sorted column A to column B - retaining the contents. So "Picture4s " is also copied, with its trailing space.
Later on, in one of the subs whose names begin with 'test' you have a line like this:
ActiveSheet.Shapes(Range("B4").Value).Copy
(it's not always B4, of course) but at one time it will happen to be the cell that contains "Picture4s " and the line will 'translate' to:
ActiveSheet.Shapes("Picture4s ").Copy
and since there is no shape with the name "Picture4s " it will fail.

Remove the trailing space from Picture4s in cell A4, 'deal new hand' and play and you should no longer get the error.
Save the file, of course.

For your information, cell A4 is the only cell in A1:A52 which contains a trailing space. The card shapes all seem to be correctly named.

ndendrinos
08-30-2009, 03:12 PM
All fixed now ... thank you
Out of curiosity how did you figure that business about the trailing space
When I click on A4 I cannot guess that there is a trailing space there.

p45cal
08-30-2009, 11:42 PM
All fixed now ... thank you
Out of curiosity how did you figure that business about the trailing space
When I click on A4 I cannot guess that there is a trailing space there.

no, but when you go to edit it on the formula bar and move to the right, the cursor goes further than it should.