+ Reply to Thread
Results 1 to 4 of 4

If a cell contains "CR" then look for a value to the left and change it to negative.

  1. #1
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    If a cell contains "CR" then look for a value to the left and change it to negative.

    I have a code already that looks for the value "CR" and changes the cell to the left of it. But I am going to have different workbooks where the value I need to change to a negative is not one cell to the left.
    Some are four cells to the left, and some are 3... and so on. So I need this code to change the first cell to the left that contains a value.

    To sum it up: If a cell equals "CR" then continue to look left for a value and change that value to a negative. Then delete the "CR" value.

    Here is my current code:
    Please Login or Register  to view this content.
    Thank you

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: If a cell contains "CR" then look for a value to the left and change it to negative.

    1) probably B:BA Range would be enough (if CR if for some reason in A you do not change anything left from it anyway)

    2) I'd look left from the c Range for appropriate cell - sth like:

    Please Login or Register  to view this content.
    (try it - not tested)
    Best Regards,

    Kaper

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: If a cell contains "CR" then look for a value to the left and change it to negative.

    PS. If you expect multiple CRs Add
    Please Login or Register  to view this content.
    at the beginning of the code

    PS2. Is this
    Please Login or Register  to view this content.
    really needed? I doubt. try commenting it out.

  4. #4
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    Re: If a cell contains "CR" then look for a value to the left and change it to negative.

    Quote Originally Posted by Kaper View Post
    1) probably B:BA Range would be enough (if CR if for some reason in A you do not change anything left from it anyway)

    2) I'd look left from the c Range for appropriate cell - sth like:

    Please Login or Register  to view this content.
    (try it - not tested)
    This code is working out great! Thank you very much for your help!

+ 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] If cell equals "CR" then make cell to left negative and delete "CR".......
    By pasqualebaldi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-14-2016, 07:51 PM
  2. Replies: 35
    Last Post: 01-13-2016, 02:16 AM
  3. Replies: 1
    Last Post: 11-04-2015, 04:34 AM
  4. "Worksheet change" not changing cell on other sheet to match target cell "fill".
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-02-2015, 12:02 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. Change "Parent" cell based on results of multiple "Children" cells
    By ccowman in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-14-2012, 02:33 AM
  7. Replies: 5
    Last Post: 06-26-2006, 09:23 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