+ Reply to Thread
Results 1 to 14 of 14

Edit cell from userform - does not work on integers

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Edit cell from userform - does not work on integers

    This userform allows editing of cells via textboxes.
    A character can be added using command buttons.
    It does not work when a cell has integers only. I've tried converting to text using "CStr" but no luck.
    How can I make it work?
    Form code is shown below. Other parts of the code are in the workbook.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    It doesn't seem to work for any of the cells for me, text or integers or both.

    As you have moved on to this, is your previous issue resolved?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Edit cell from userform - does not work on integers

    As you have moved on to this, is your previous issue resolved?
    No, my other issue is still outstanding.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    OK - just checking. You might wish to bump it (which is allowed once a day).

    As I mentioned above, this user form does not work for me in Excel 365 at all, although it's not entirely clear how it is meant to be used!

  5. #5
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Edit cell from userform - does not work on integers

    does not work for me in Excel 365
    I guess I'm using Excel 2007.
    not entirely clear how it is meant to be used
    The form will also contain Greek letters and other miscellaneous characters that cannot be typed. It will be used to edit and equation. So if want to have an equation with the character "∞" just click a button to add it.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    I guess I'm using Excel 2007.
    That should make no difference - VBA should (I believe) be forward compatible. I have never seen any issues except with 64-bit 365, which I don't have.

    So basically you want to use this as a shortcut to Insert > Symbol?

    I think it would be really helpful here, and in the other thread, if you gave a step-by-step example of how you are testing these forms, e.g.

    1. Select the range x to y.
    2. Click to open the form ... etc.
    3. Result: X Expected result: Y

    This would make troubleshooting easier and more precise, as we'd all be doing exactly the same thing. At the moment there are too many possible variables! You need to approach this a bit like a scientific experiment.

  7. #7
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Edit cell from userform - does not work on integers

    OK. It's basically.

    1. Select range.
    2. Click to open form,
    3. Select box you want to edit.
    4. Place cursor where you want the character to be inserted.
    5. Insert character using a command button.

    Nothing counter-intuitive.

    The issue in my opinion is that cells with "integers only" are not treated as a string. I tried to convert to a string using "CStr" but no success.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    1. Select range - which range?

    The devil is in the detail - you MUST be precise and specific!

    Nothing counter-intuitive.
    No, but remember it's obvious to you because you keep doing it, but until now you have not told us EXACTLY how you are testing this.

    I sense that you resent being asked for extra details, and I rather feel that you also think I'm a bit thick. I hope that I am wrong about both.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    OK - so now I know how to use the form, I can confirm your findings. This would have been useful to share:

    Please Login or Register  to view this content.
    The debug is indicating an error in this line of code if I try to insert a character into the integer only cell.

    I can see what the issue is, but my VBA skills aren't good enough to help fix it: an entry that has all characters or a mixture of characters and integers is seen by Excel (and VBA) as a text string. When there are just integers, it's a number, and the code is looking for a text string, hence the error message.
    Last edited by AliGW; 11-01-2019 at 03:49 AM.

  10. #10
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Edit cell from userform - does not work on integers

    Yes I do hate going into the details, this is because I think all the information is in the original post.
    No I don't think you're thick, that would be me.

    1. Select range - which range?
    This is the range you want to edit, or place a special character in there. The benefit of a range is that you can edit more than one cell at a time. The benefit to doing this is that I don't have to open up Character Map and search for special characters.

    As suggested it does not work on cells which are integers only.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    Please see my edit to the post above.

    The problem is that you HAVE to go into detail if you want to get these issues solved quickly. Just because you think you've given enough detail doesn't mean that you have: remember, it is YOU that is looking for help here!

    If you fail to give the detail requested, your helpers will lose interest and give up on you - that's the bottom line. I really do feel that this is why your other thread has stalled - you have been reluctant to answer questions and failed to explain, step-by-step, what you are doing so that your helpers can replicate it exactly.

    I am saying this to try to help you to get solutions to your problems, not because I am targeting you in any way.

  12. #12
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Edit cell from userform - does not work on integers

    Yes but most of my questions have gotten resolved, which is a much better outcome than I anticipate.
    I do understand about the volunteer aspect of it.

    code is looking for a text string
    Yes this is what I'm trying to say.

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Edit cell from userform - does not work on integers

    You'll either need to prefix the cell with an apostrophe or ensure it's formatted as text before the data is entered.
    Everyone who confuses correlation and causation ends up dead.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,006

    Re: Edit cell from userform - does not work on integers

    The point is that the code requires a text string, so what you need is code that will accept either text or numbers (that's the bit I can't help you with).

    I said nothing about anyone here being volunteers (that was yesterday) - my point today is that if your helpers don't get the precise detail they need to be able to troubleshoot your issue, then they just move on to something else they can help to solve.

    Yes, most of your issues may have been solved - I am trying to help you get a resolution to this and yesterday's issues. Anyway, I shall bow out now and leave this to the VBA experts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Cell lookup and edit via userform
    By ste2610 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2016, 07:21 AM
  2. [SOLVED] Userform text box to display and edit a single cell only
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 11-25-2013, 08:50 AM
  3. VBA Userform - Restrict Text Box to integers between 18 - 80
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2013, 03:38 PM
  4. Vlookup doesn't work until i edit(but not change) the lookup cell
    By Confused in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-08-2005, 05:25 AM
  5. A list of Consecutive Integers, can I search for missing integers
    By CM in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  6. A list of Consecutive Integers, can I search for missing integers
    By Harlan Grove in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-06-2005, 05:05 AM
  7. A list of Consecutive Integers, can I search for missing integers
    By CM in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1