Argument Not Optional Error

RGButzArchInc

New Member
Joined
Aug 16, 2009
Messages
24
When I run this code in AutoCad VBA I get this error
Rich (BB code):
Dim HighestHigh as Double


Call BarsInTrade((objExcelSheet)
Call HistoricalHigh(objExcelSheet) Argument Not Optional Error Occurs Here

Public Function HistoricalHigh(BarsInTrade, objExcelSheet)


'Declare


    Dim HighMax As Double
    Dim HighestHigh As Double
    
'Assignment


    HighMax = objExcelSheet.Cells.Max(C1, C(BarsInTrade))
    
'Executable
      
    HighestHigh = HighMax


End Function
 
Last edited by a moderator:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
HistoricalHigh requires two arguments and you're only passing one.
 
Upvote 0
When I run this code in AutoCad VBA I get this error
Rich (BB code):
Dim HighestHigh as Double


Call BarsInTrade((objExcelSheet)
Call HistoricalHigh(objExcelSheet) Argument Not Optional Error Occurs Here

Public Function HistoricalHigh(BarsInTrade, objExcelSheet)


'Declare


    Dim HighMax As Double
    Dim HighestHigh As Double
    
'Assignment


    HighMax = objExcelSheet.Cells.Max(C1, C(BarsInTrade))
    
'Executable
      
    HighestHigh = HighMax


End Function

When I add BarsInTrade I get the same error.

Call HistoricalHigh(BarsInTrade, objExcelSheet) Argument Not Optional Error Occurs Here
 
Upvote 0
How is the BarsInTrade function declared?
 
Upvote 0
When I add BarsInTrade I get the same error.

Call HistoricalHigh(BarsInTrade, objExcelSheet) Argument Not Optional Error Occurs Here



Dim BarInTrade As Long

Declared as stated below.

Call BarsInTrade(objExcelSheet)

'-----------------------------------------------------
Public Function BarsInTrade(objExcelSheet) As Long
'-----------------------------------------------------


'Declare


Const xlup As Long = -4162



'Executable

BarsInTrade = objExcelSheet.Cells(objExcelSheet.Cells.Rows.Count, "A").End(xlup).Row
 
Upvote 0
BarsInTrade requires an argument and you aren't passing any. It would be:
Code:
Call HistoricalHigh(BarsInTrade(objExcelSheet), objExcelSheet)
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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