+ Reply to Thread
Results 1 to 1 of 1

Change selected cell value if number, mark selected cell if text string

  1. #1
    Registered User
    Join Date
    03-05-2020
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    17

    Question Change selected cell value if number, mark selected cell if text string

    Hi,

    I am trying to make a macro that multiplies a cell value containing a '€' symbol if it is a number by an input, or marks the cell if it contains a '€' symbol if it contains a text string.
    However, there are a couple different situations that make this difficult for me:
    1. Cell value is a number in currency format (in this case, cell value needs to be multiplied by input value)
    2. Cell value is a number in financial format (in this case, cell value also needs to be multiplied by input value)
    3. Cell contains a text string containing a '€' symbol somewhere in the sentence (in this case, cell needs to be marked with a color)

    I made a macro by combining different parts of code that I found, and so far it does the following:
    It first asks for the input with a msgbox. Then selects all the cells containing a '€' symbol. So far so good
    Then, it should multiply cell value by input if cell contains a number, else mark cell with a color.
    This last part is not functioning properly: it works until it encounters a cell containing a text string, then jumps to the Errorhandler instead of marking the cell.
    I can sort of construct macro's by combining code I find on the internet, but I'm unable to fix any issues that I'm encountering here for example.
    Therefore, I'm not sure how to fix this issue myself. Please help me!

    This is the code I have so far:

    Please Login or Register  to view this content.
    Attached you can find an example file showcasing a 'before' and 'after' (as if macro works properly).
    It can also be used to see the current issue I am facing, as it will jump to the Errorhandler when the code reaches cells in Column H.

    Thank you in advance!
    Attached Files Attached Files

+ 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. Button that inserts a text into a selected cell or a range on selected cells
    By gorely84 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2018, 10:47 PM
  2. Change Selected Cell Colour ...only whilst selected
    By mrgrotey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2017, 07:40 AM
  3. [SOLVED] Change text color of selected cells based on a text value of another cell
    By JNEWBURY2280 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2014, 11:26 PM
  4. Replies: 1
    Last Post: 12-06-2010, 12:05 AM
  5. Search Selected Data for a Text String and replace entire cell with new tex
    By maz003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2010, 02:26 PM
  6. Replies: 3
    Last Post: 07-17-2006, 03:30 AM
  7. Replies: 1
    Last Post: 07-06-2006, 08:14 AM

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