Compile Error: Sub or Function not defined

ryancgarrett

Board Regular
Joined
Jun 18, 2011
Messages
122
What is wrong with this code? I can't get it to run at all and I've gone through it over and over again. It seems like it should be pretty simple.

Sub COGS()
Dim todayTotal As Long
Dim acctgWarehouse As Long
Dim monthToDate As Long
Dim curRow As Integer

todayTotal = InputBox("Cost of Goods Sold?")
acctgWarehouse = InputBox("000 Warehouse?")
curRow = 7

Do While Cells(curRow, 4).Value = Empty
curRow = curRow + 1
Loop

Cells(curRow, 4).Value = todayTotal + Sum(Range("D7:D" & curRow)) + acctgWarehouse


End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try

Rich (BB code):
Cells(curRow, 4).Value = todayTotal + WorksheetFunction.Sum(Range("D7:D" & curRow)) + acctgWarehouse
 
Upvote 0
Change:

Do While Cells(curRow, 4).Value = Empty

To:

Do While IsEmpty(Cells(curRow, 4))
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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