Results 1 to 18 of 18

Argument not optional error while passing value of variable between subs

Threaded View

asha3010 Argument not optional error... 09-29-2010, 10:26 AM
Domski Re: Argument not optional... 09-29-2010, 10:34 AM
snb Re: Argument not optional... 09-29-2010, 10:36 AM
asha3010 Re: Argument not optional... 09-29-2010, 10:48 AM
Domski Re: Argument not optional... 09-29-2010, 11:11 AM
romperstomper Re: Argument not optional... 09-29-2010, 11:38 AM
asha3010 Re: Argument not optional... 09-30-2010, 03:52 AM
romperstomper Re: Argument not optional... 09-30-2010, 03:56 AM
asha3010 Re: Argument not optional... 09-30-2010, 04:13 AM
romperstomper Re: Argument not optional... 09-30-2010, 04:23 AM
Andrew-R Re: Argument not optional... 09-30-2010, 04:23 AM
romperstomper Re: Argument not optional... 09-30-2010, 04:31 AM
asha3010 Re: Argument not optional... 09-30-2010, 04:38 AM
asha3010 Re: Argument not optional... 09-30-2010, 04:44 AM
romperstomper Re: Argument not optional... 09-30-2010, 04:46 AM
asha3010 Re: Argument not optional... 09-30-2010, 04:59 AM
romperstomper Re: Argument not optional... 09-30-2010, 05:03 AM
asha3010 Re: Argument not optional... 09-30-2010, 05:21 AM
  1. #1
    Forum Contributor
    Join Date
    02-09-2010
    Location
    Constanta
    MS-Off Ver
    Excel 2007
    Posts
    128

    Argument not optional error while passing value of variable between subs

    Greetings,

    I would like to pass value of a variable (iRowdata) from Sub Test1 to Sub Test2. I followed the recommendation from this thread, unfortunately I get a "Argument not optional" error.

    Here's a snippet of the main code (all in the same standard module).

    Any ideas as to what is wrong? Many thanks in advance
    Asha

    Option Explicit
    Dim rCoDE As Range
    Dim rCoDB As Range
    Dim WF As WorksheetFunction
    
    Sub Test1()
    Dim rCell As Range
    Dim iCol As Integer             
    Dim iRowdata As Integer        
    Dim r As String                 
    
    'Define variable(s)
    Set rCoDE = Names("DE_Co").RefersToRange
    Set WF = Application.WorksheetFunction
    iRowdata = WF.CountIf(rCoDE, "<>-")
    iCol = 2
    
    Call Test2(iRowdata)
    
    ‘REST OF THE CODE
    
    Set rCoDE = Nothing
    Set rCoDB = Nothing
    Set WF = Nothing
    
    End Sub
    
    Sub Test2(iRowdata As Integer)
    
    Dim wDest As Worksheet              
    Dim iCNDup As Integer               
    Dim rCopy As Range                 
    Dim rErrCells As Range              
    
    Application.ScreenUpdating = False
    
    'Define variable(s)
    Set WF = Application.WorksheetFunction
    Set rCopy = Names("DE_InputRange").RefersToRange.Resize(WF.Max(iRowdata, 1))
    
    ‘REST OF THE CODE        
    
    Set wDest = Nothing
    Set rCopy = Nothing
    Set WF = Nothing
    Exit Sub
            
    End Sub
    Last edited by asha3010; 09-30-2010 at 05:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1