Hi everyone,
I wonder if someone could help me to convert the following formula into VBA as I'm not very good with VBA so need some help from you.
Thank youPlease Login or Register to view this content.
Hi everyone,
I wonder if someone could help me to convert the following formula into VBA as I'm not very good with VBA so need some help from you.
Thank youPlease Login or Register to view this content.
An easy way is just to do this (all examples for just the first formula)
In straight VBA code, that would bePlease Login or Register to view this content.
Please Login or Register to view this content.
IF you want to put that formula into a number of cells, then use
Please Login or Register to view this content.
Bernie Deitrick
Excel MVP 2000-2010
Hi Bernie,
Thank you for your response.
It's coming up as message box but I want the result in a cell C11 onwards. I have attached a spreadsheet here with example, which hopefully make sense.
You will notice that there is currently a formula but that only works for "X" however I want to generalised it to "Y" & "Z". - So if you select X in Column F - it will add 20% of the total to that cell and reduce every other cell to keep the same total. I want the same for "Y" but add 10% and for "Z" keep it what it is and no change. I tried it with formula but unfortunately I couldn't crack it therefore I thought doing through VBA will be much easier.
Really appreciate your guidance.
Many thanks,
There really is no difference between using formulas in a worksheet, and doing the same with VBA. You just need to explain what you want, so re-do your example workbook, and duplicate that sheet a few times, and show what you want with one X, two Xs, three X's Then the same for Y, and then for Z and what you want for mixed X, Y, and Z values. And use other cells to explain your logic - just type the explanation into cells where appropriate.
Last edited by Bernie Deitrick; 04-21-2020 at 08:56 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks