+ Reply to Thread
Results 1 to 4 of 4

Macro for identifying text in reference cell and inserting a blank value in target cell

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro for identifying text in reference cell and inserting a blank value in target cell

    Hello. I hope somebody can lend some assistance and guidance with the correct VB coding because I have been going round in circles trying some of the basic codes on webinars/podcasts and they don't seem to work

    I have a Reference Cell (H2:I2) in which there is a drop down list with two options: 1/. "SALES INVOICE" OR 2/. "QUOTATION". This has been set via a simple Data Validation process.

    Cell I25 (the target cell) contains a simple formula in it "=(I22-I23+I24)*16%". It calculates Sales tax at 16% rate for the three rows above.
    Row I22 = the subtotal of purchased products
    Row I23 = any discounts to be deducted
    Row I24 = Any freight costs to be added.

    When the text "Sales Invoice" is selected in the Reference Cell (H2:I2) then all the formulas contained in each of the subsequent rows mentioned should automatically calculate various values.

    However if the text "Quotation" is selected in the Reference Cell then I need the macro to bypass the formula in I25 AND simply place the text "-----" ie. five space bars without deleting the formula "=(I22-I23+I24)*16%".

    Any ideas please - somebody - anybody out there who can shed some light. I really need some urgent assistance on this one.

    Thanks.
    Last edited by BillBakos; 10-28-2013 at 09:52 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Macro for identifying text in reference cell and inserting a blank value in target cel

    I think a simple If function in the cell I25 will do the trick

    =if(H2="Sales Invoice",(I22-I23+I24)*16%,"")
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    10-22-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro for identifying text in reference cell and inserting a blank value in target cel

    Quote Originally Posted by alansidman View Post
    I think a simple If function in the cell I25 will do the trick

    =if(H2="Sales Invoice",(I22-I23+I24)*16%,"")
    Thanks a bunch. It seems to be doing the trick nicely. Will report back if I hit any more bumps along the way.

    Best regards Alan. Awesome mate.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Macro for identifying text in reference cell and inserting a blank value in target cel

    Bill
    You are welcome.

+ 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. Recoding macro to add all cells above a target cell until there is a blank row.
    By PatrickDC in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 10-22-2013, 06:56 AM
  2. How to have a cell return blank when the target cell it is copying is blank
    By DanielWinning in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-23-2013, 11:14 AM
  3. [SOLVED] Macro to change text colour of adjacent cell to the same text colour as target cell
    By kayoke in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-28-2012, 04:18 AM
  4. Need help inserting text into ever 7th (blank) cell.
    By deenix in forum Excel General
    Replies: 2
    Last Post: 08-26-2011, 03:17 PM
  5. Replies: 1
    Last Post: 02-19-2007, 04:52 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