Hello,
So I have a pretty complex macro I'm trying to design, but my VBA experience isn't quite there yet... any help would be greatly appreciated. My workbook consists of 3+ sheets (sheets will be added/removed as time progresses), Rep1 (and later on Rep2, Rep3, etc), StoreTotals (this is pulled from a system, so it will vary each time it's pulled) ,and Pacing (This is where everything will be totalled). Each sheet will have more or less rows added as things progress (so I'd need the macro to run to the last row of each sheet essentially). I included a "Pacing(Example)" sheet to sortof give an idea of what I'm looking for. Here's what I'm looking for:
- I need the macro to pull the data from the Rep1 sheet (and eventually Rep2, Rep3, etc) into the Pacing sheet in the format provided (maybe include a totals row every time the Order Request name Changes).
- Go through each row on the Pacing sheet, take the Order ID, and add up the Totals and Total Caps from the StoreTotals sheet that have a matching Order ID into the corresponding columns in the Pacing sheet.
- Add the totals up for each Order Request into a gray row... see "Pacing(Example)" sheet
- If the Total Cap is higher than the Total Goal... add "Warning: Total Cap is Higher than Total Goal" in the Errors column
- If the Total Cap is lower than Total Goal add "Warning: Total Caps is Lower than Total Goal"
- If the total Cap matches the Total Goal... do nothing
- If Total is equal to Total Cap... mark green in Notes with "Order fulfilled for Request"
- If Total is lower than Total Cap:
- Divide Total from Total Cap to get Percent Complete (ie if the Total is 162 and the
Total Cap is 208... 162/208 = 78% percent complete)
- Subtract Start Date from End Date to get Total Days... then subtract Start Date
from Todays Date for Days Running)... divide Days Running by Total Days to get
Percentage of Time Order is Running
- If Percent of Time equals Percentage Complete, we're on Pacing. If Percentage
Complete is greater than Percentage of Time than we're ahead of Pacing. If
Percentage is less than Percentage of Time than we're behind on Pacing
- If on Pacing mark Green with "Pacing" in Notes... if above Pacing mark Green with "Ahead of Pacing" in Notes... if below Pacing Mark Red with "Behind on Pacing" in Notes
... I hope this helps, I'm working on this as I go through Tutorials in the mean time... but I was trying to see if somebody could either figure this out faster, get me a good starting point, or point me in the right direction. I know this sheet is kindof a mess and confusing so if there are any questions please let me know and I'll explain. If this is too large a task, feel free to tell me to piss off and I'll figure it out haha. Thanks tremendously for any help in the mean time.
So I have a pretty complex macro I'm trying to design, but my VBA experience isn't quite there yet... any help would be greatly appreciated. My workbook consists of 3+ sheets (sheets will be added/removed as time progresses), Rep1 (and later on Rep2, Rep3, etc), StoreTotals (this is pulled from a system, so it will vary each time it's pulled) ,and Pacing (This is where everything will be totalled). Each sheet will have more or less rows added as things progress (so I'd need the macro to run to the last row of each sheet essentially). I included a "Pacing(Example)" sheet to sortof give an idea of what I'm looking for. Here's what I'm looking for:
- I need the macro to pull the data from the Rep1 sheet (and eventually Rep2, Rep3, etc) into the Pacing sheet in the format provided (maybe include a totals row every time the Order Request name Changes).
- Go through each row on the Pacing sheet, take the Order ID, and add up the Totals and Total Caps from the StoreTotals sheet that have a matching Order ID into the corresponding columns in the Pacing sheet.
- Add the totals up for each Order Request into a gray row... see "Pacing(Example)" sheet
- If the Total Cap is higher than the Total Goal... add "Warning: Total Cap is Higher than Total Goal" in the Errors column
- If the Total Cap is lower than Total Goal add "Warning: Total Caps is Lower than Total Goal"
- If the total Cap matches the Total Goal... do nothing
- If Total is equal to Total Cap... mark green in Notes with "Order fulfilled for Request"
- If Total is lower than Total Cap:
- Divide Total from Total Cap to get Percent Complete (ie if the Total is 162 and the
Total Cap is 208... 162/208 = 78% percent complete)
- Subtract Start Date from End Date to get Total Days... then subtract Start Date
from Todays Date for Days Running)... divide Days Running by Total Days to get
Percentage of Time Order is Running
- If Percent of Time equals Percentage Complete, we're on Pacing. If Percentage
Complete is greater than Percentage of Time than we're ahead of Pacing. If
Percentage is less than Percentage of Time than we're behind on Pacing
- If on Pacing mark Green with "Pacing" in Notes... if above Pacing mark Green with "Ahead of Pacing" in Notes... if below Pacing Mark Red with "Behind on Pacing" in Notes
... I hope this helps, I'm working on this as I go through Tutorials in the mean time... but I was trying to see if somebody could either figure this out faster, get me a good starting point, or point me in the right direction. I know this sheet is kindof a mess and confusing so if there are any questions please let me know and I'll explain. If this is too large a task, feel free to tell me to piss off and I'll figure it out haha. Thanks tremendously for any help in the mean time.