+ Reply to Thread
Results 1 to 7 of 7

Multi calculation in one macro code

  1. #1
    Forum Contributor
    Join Date
    07-27-2017
    Location
    Dhaka
    MS-Off Ver
    MS Excel 2019/ 64 bit
    Posts
    159

    Multi calculation in one macro code

    Dear Expert,
    in my worksheet i want to do few calculation by vba code.

    My calculation as below:
    1. if N6:P6 any data match with "yes" then BO6 should "Embellishment" other "No Embellishment".

    2. =SUM(AI6:AJ6) at BP6

    3. =IF(AND(BP6>=0,BP6<=4.5),"A",IF(AND(BP6>=4.51,BP6<=7.5),"B",IF(AND(BP6>=7.51,BP6<=15),"C",IF(AND(BP6>=15.1,BP6<=28),"D",IF(BP6<=28.1,"E"))))) at BQ6

    4. =IF(BL6-(INT((BL6-1)/7)*7+1)>5,(INT((BL6-1)/7)*7+1),(INT((BL6-1)/7)*7+1)-7) at BR6

    5. =AO6*Z6 at BS6

    6. =AN6*Z6 at BT6

    7. =AI6*Z6/60 at BU6

    8. =AJ6*Z6/60 at BV6

    All calculation should be calculated for all row on respective column that contains data means like 6. AN6*Z6 at BT6 and also should AN7*Z7 at BT7 and more all row in this column which contains data not blank . (in a column calculation should go up to available data range)

    Please help me to get the code.

    Best Regards
    Wahid

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: Multi calculation in one macro code

    Hi Rachael,

    Could you supply a sample workbook (attach it like the instructions in yellow at the top) so we can give you a great answer. You should also mark in yellow which cells are calculated.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    07-27-2017
    Location
    Dhaka
    MS-Off Ver
    MS Excel 2019/ 64 bit
    Posts
    159

    Re: Multi calculation in one macro code

    Dear Expert,
    Please see attached file sheet1 is my working sheet where i want to calculate as above data.

    thanks.
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: Multi calculation in one macro code

    Hi rachel,

    I have to ask, why aren't formulas good enough? Why do you need this is VBA? Do you want the VBA to overwrite all the formulas so you have values only? This is a lot of code that might not do what you need.

    Do you want the VBA to put in your formulas for all rows that are filled in (from 6 down)?
    Last edited by MarvinP; 03-29-2020 at 12:33 AM.

  5. #5
    Forum Contributor
    Join Date
    07-27-2017
    Location
    Dhaka
    MS-Off Ver
    MS Excel 2019/ 64 bit
    Posts
    159

    Re: Multi calculation in one macro code

    Hi,
    After fill up my total data Column A:BN then i need my calculated column data BP,BQ,BR,BS,BT,BU,BV before that it should blank.
    that's why i need a code so that agter entering data A:BN then i run the macro code to get other column data and that will be only value (BP:BV).
    Please consider it.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: Multi calculation in one macro code

    Hi Rachel,

    I've asked others to join in and help with this problem. I'm not sure I understand how why you clear all your formulas to start over. Might you keep the first row of formulas and not clear them? Then you could pull that top row down to the other blank rows?

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Multi calculation in one macro code

    Use another if or error statement that will keep the cells blank until you have values in the other cells.

+ 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. VBA Code for Demand calculation using multi level BOM
    By EinarG in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2014, 06:15 PM
  2. [SOLVED] Macro Code for multi-user .xlsm document
    By maheshle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-27-2012, 03:20 PM
  3. Multi filtering and calculation using lists (I think)
    By RichMelbourne in forum Excel General
    Replies: 0
    Last Post: 08-23-2012, 03:35 AM
  4. [SOLVED] Formula Calculation from multi cell to 1
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 49
    Last Post: 03-04-2012, 11:18 AM
  5. Macro Amendment Required For Calculation Code
    By JimmiOO in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2010, 08:16 AM
  6. Need help with multi-calculation function
    By toastysquirrel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2009, 06:54 PM
  7. macro code for grouping adjacent cells into one multi-line cell
    By M John in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2005, 12:15 PM

Tags for this Thread

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