Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 29th, 2007, 02:50 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Argument not Optional

Hi all,

I am fairly new to VBA and have the following problem:

I have the following sub:

Code:
Public Sub AllocateLinks()
    ...
End Bub
This routing is part of the worksheet wsTurns and I call it as:

Code:
Private Sub btnAssignSections_Click()
    wsTurns.AllocateLinks
End Sub
This however causes an Argument not Optional error message which I do not understand.

Thanks for all help,

Hans


Reply With Quote
  #2 (permalink)  
Old July 29th, 2007, 04:52 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hans,

"Argument Not Optional" error is normally thrown when a method requires parameters.

Are you sure there are no parameters for the AllocateLinks Sub??

I am also assuming "wsTurns" is an actual Worksheet, not Worksheets (Collection) Object??
If it is actually a Worksheets Object, then this may cause the error.

Regards,
Rob

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
Reply With Quote
  #3 (permalink)  
Old July 30th, 2007, 04:18 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sure there is no argument required by the function. wsTurns is a worksheet object not a collection.

Cheers,

Az.

Reply With Quote
  #4 (permalink)  
Old July 31st, 2007, 03:40 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Does the error occur at compilation or run-time?

Regards,
Rob

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
Reply With Quote
  #5 (permalink)  
Old August 1st, 2007, 12:49 AM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem occurs at run time.

Cheers,

Az

Reply With Quote
  #6 (permalink)  
Old August 1st, 2007, 02:53 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

What line does the error occur on?? Step through the program at run time to see where it falls over.

When you find the line that is causing the problem. Examine each of the objects to see where it is going wrong.

Regards,
Rob

<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative to optional parameters in C# asptwodev BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 November 12th, 2007 03:47 AM
Optional prameters and C#? NewTitle2007 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 August 5th, 2007 12:17 PM
compile error: argument not optional loverman210 Beginning VB 6 3 June 8th, 2007 07:59 AM
Error: Argument not optional toshesh Excel VBA 10 January 20th, 2006 10:57 AM
optional where in stored proc david_ste SQL Server ASP 2 October 27th, 2005 07:16 AM



All times are GMT -4. The time now is 02:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.