Consulting

Results 1 to 6 of 6

Thread: Solved: Infernal 4s

  1. #1
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location

    Solved: Infernal 4s

    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.
    Thank you for your help

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Easy, cell A4 contains
    "Picture4s " instead of
    "Picture4s"
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    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?
    Last edited by ndendrinos; 08-30-2009 at 03:15 PM.
    Thank you for your help

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    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.
    Last edited by p45cal; 08-30-2009 at 02:39 PM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    VBAX Mentor
    Joined
    Sep 2004
    Posts
    431
    Location
    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.
    Thank you for your help

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Quote Originally Posted by ndendrinos
    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.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •