Can you explain please this piece of code

  • Hi,

    I have a code which works fine in respect of sending values from my userform to my worksheet.

    However there is one issue.


    TextBox4 on my userform is expecting a post code to be entered.

    Once i transfer values to worksheet this post code should be placed into the cell at column D

    What actually is pasted into this cell is 0 "zero"


    Here is the code that relates to it.

    Changing Case 3 to -1 does the trick BUT what is it there for to start with ?


    Thanks



  • Ok i understand what youve mentioned.

    what i dont understand is why ive got it there in the first place ??


    What do you advise this code to be like as i just see it as pointless for it to be there.

  • Your code was using VAL which tries to convert a String to a number. It wasn't working because a Post Code contains letters as well as numbers.


    I've added code to remove the space and then split the the post code. I've done this in case the user enters the post code without a space.