+ Reply to Thread
Results 1 to 3 of 3

Define % amount in macro?

  1. #1
    Registered User
    Join Date
    06-02-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    59

    Define % amount in macro?

    Hi folks,

    I'm using the following macro (see code below) to turn a value in column i to zero, if some particular text is found in column C.

    The macro also adds another number (defined in the macro) to column D.

    I'd like to tweak it so that instead of setting the amount to zero in i, it instead calculates a percentage of the value in column F.

    I've attached an example xlsm sheet which has the problem set up for just one row, but obviously it needs to work on all rows and all sheets in the workbook (starting at row 9 in each sheet).

    It's ok if i just set the percentage in the macro, i don't need a pop-up box like the text search in the macro.

    Thanks, hopefully, in advance!

    The code:

    ----------------------------------------------------

    Please Login or Register  to view this content.
    ----------------------------

    example.xlsm
    Last edited by jeffreybrown; 03-19-2024 at 09:08 AM. Reason: Please use code tags!

  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,623

    Re: Define % amount in macro?

    I'm not sure if I ubderstood you well, but how about instead of your one line with writing 0 to cell.Offset(, 6) using two lines:

    Please Login or Register  to view this content.
    one line calculates what is the percentage of columnF value in a given constant value (200 in the example above)
    and second line making sure calculated value is dilplayed in percent format.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    06-02-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    59

    Re: Define % amount in macro?

    Thanks, I'll try that!

+ 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. Need to define a search or define instruction to extract parts of data from cell
    By Dawn Clark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2021, 02:45 AM
  2. Define Top 20% out of remaining 70% of sales amount
    By Cjulien10 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-22-2020, 10:38 AM
  3. [SOLVED] Getting compile error user-define type not define
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-07-2015, 07:22 AM
  4. [SOLVED] Define variable in macro than calling that macro inside another macro
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2015, 10:58 AM
  5. keep getting a application define or object define runtime error
    By JRJLHJ1823 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2015, 08:55 PM
  6. error 1004 application define or object define
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2011, 04:09 AM
  7. Define named range where user can define size
    By nahousto in forum Excel General
    Replies: 4
    Last Post: 07-06-2009, 05:09 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