Excel Button for an order guide

Mrupe86

New Member
Joined
Jun 22, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I am struggling with my excel spreadsheet. I take a weekly inventory of items and subtract it from a needs list to create orders for the week. My coworker does it manually, but I decided to assist by making buttons for him to do various tasks. I can't seem to get this one button accomplished.

Difference between If G-F (is positive) / spread the number needed into the four columns. If G-F (is negative) then 0.

I can move columns around if needed and make adjustments in my current macros. Any help is appreciated!
Screenshot 2024-07-20 123202.png


I tried a few SpreadEven VBA codes I found online. I was unable to make the needed adjustments to make it work.
 
I am struggling with my excel spreadsheet. I take a weekly inventory of items and subtract it from a needs list to create orders for the week. My coworker does it manually, but I decided to assist by making buttons for him to do various tasks. I can't seem to get this one button accomplished.

Difference between If G-F (is positive) / spread the number needed into the four columns. If G-F (is negative) then 0.

I can move columns around if needed and make adjustments in my current macros. Any help is appreciated! View attachment 114305

I tried a few SpreadEven VBA codes I found online. I was unable to make the needed adjustments to make it work.

I am struggling with my excel spreadsheet. I take a weekly inventory of items and subtract it from a needs list to create orders for the week. My coworker does it manually, but I decided to assist by making buttons for him to do various tasks. I can't seem to get this one button accomplished.

Difference between If G-F (is positive) / spread the number needed into the four columns. If G-F (is negative) then 0.

I can move columns around if needed and make adjustments in my current macros. Any help is appreciated! View attachment 114305

I tried a few SpreadEven VBA codes I found online. I was unable to make the needed adjustments to make it work.
VBA Code:
Sub Distribute()
Range("H6").Formula2 = "= IF(($F6-$G6)>0,ROUND(($F6-$G6)/4,),""0"")"
Range("I6:K6").Formula2 = "= IF(($F6-$G6)>0,ROUND(($F6-$G6-SUM($H6:H6))/(COLUMN($I6)+2-COLUMN(H6)),),""0"")"
With ActiveSheet
Range("H6").AutoFill Destination:=Range("H6:H" & Range("H" & Rows.Count).End(xlUp).Row)
Range("I6").AutoFill Destination:=Range("I6:I" & Range("I" & Rows.Count).End(xlUp).Row)
Range("J6").AutoFill Destination:=Range("J6:J" & Range("J" & Rows.Count).End(xlUp).Row)
Range("K6").AutoFill Destination:=Range("K6:K" & Range("K" & Rows.Count).End(xlUp).Row)
End With
Dim ws As Worksheet, rng As Range

For Each ws In ActiveWorkbook.Worksheets

For Each rng In ws.UsedRange

If rng.HasFormula Then

rng.Formula = rng.Value

End If

Next rng

Next ws

End Sub
 
Upvote 0
Solution

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,808
Messages
6,181,072
Members
453,020
Latest member
mattg2448

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top