+ Reply to Thread
Results 1 to 10 of 10

Macro to input % if there was a change in percentage

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Macro to input % if there was a change in percentage

    I have a macro that has a message box that allows a user to input a %

    I would like it amended so that it displays the current % in the message box so that the user can click ok if there was no change or simply amend it


    It would be appreciated if someone could kindly assist me


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

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to input % if there was a change in percentage

    Hi, you can do this:
    Please Login or Register  to view this content.
    but why do you define tempStr as String? A percentage is nothing more than a formatted value.

    Cheers
    Erwin
    Last edited by Eastw00d; 06-05-2020 at 01:34 AM. Reason: typo
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to input % if there was a change in percentage

    Thanks for the reply

    How do I set this up without the tempstr ?

    Also message box now how 0 in message box after using your code instead of 10% which is in cell I1

  4. #4
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to input % if there was a change in percentage

    Not sure if I understand you, but you can do something like this:
    Please Login or Register  to view this content.
    The default value is the value taken from the sheet, that is existing.
    Cheers
    Erwin

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to input % if there was a change in percentage

    Thanks Erwin

    Where I have 2 sheets, and have 10% in I1 on both sheets, the first input box appears with 10 and the second one also with 10, although the % on sheet2 is 5%

    I would like this amended and secondly would like the default % to appear in message box for eg 10%
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to input % if there was a change in percentage

    Hi Howard, since you are working with the WITH-END WITH statement, you only have to add a dot
    Please Login or Register  to view this content.
    I admit that I didn't see that before ....
    But you must make clear in your text, which percentage/which worksheet you are changing/displaying.
    Now it is not clear.

    Cheers
    Erwin

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to input % if there was a change in percentage

    thanks for your input, which I have noted

    code work now on both sheets

    It would be appreciated if you could amend code so that % appears after number in message box/inputbox

    have shown screen prints of how it is displaying currently and how I would like it to appear
    Attached Images Attached Images

  8. #8
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to input % if there was a change in percentage

    That, my friend, is not so easy, because the output must be a number, not a string. After all, I think you want to calculate with it.
    But I will see what I can do.

    Cheers
    Erwin

  9. #9
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to input % if there was a change in percentage

    It is not completely fool-proof, but it will do:
    Please Login or Register  to view this content.
    Cheers
    Erwin

  10. #10
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to input % if there was a change in percentage

    Hi Erwin


    Thank you very much. Code works perfectly -just what I was looking for

+ 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. Possible to change this application input box to a userform in macro?
    By barman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2019, 01:33 PM
  2. [SOLVED] Macro Input Change From InputBox to Cell
    By Gtrtim112 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2019, 01:46 AM
  3. Change filepath in macro based on textbox in form input
    By Jenkins27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2015, 09:21 PM
  4. i want to have a macro code change based on input from a textbox in a form
    By Jenkins27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2015, 07:24 PM
  5. Input box that change the macro
    By jnh0 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 02:40 AM
  6. [SOLVED] Change input text into upcase using macro
    By sarat47.dash in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2013, 03:35 PM
  7. Custom change Macro's Range value, from cells input.
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2009, 11:54 PM

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