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
Bookmarks