Passing a range of multi dimensional array to a paramarray function

shivgan3

New Member
Joined
Feb 11, 2013
Messages
11
Hi,
I am passing a range of multi dimensional array to a paramarray function input and facing error.
When I try to pass inputrange as argument to the param array it fails.
I want to pass abc,xyz, pqr which are contitudent of inputrange() variable where inputrange(0)=abc, inputrange(2)=xyz and so on.




Is it because of passing of only variant is allowed as param array input?
Can we pass complex object like array of ranges to an input of a pram array, are bound by the definition of variant that we can supply only ranges, worksheets, workbooks and other defined object?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Code:
Public Function PA_function1(ParamArray Inputrange1() As Variant) As Variant
'Inputrange(): list of range seperated by commas ranges
PA_function1 = PA_function2(Argument1, argument2, Inputrange2))
   
End Function
 
Private Function PA_function2(ParamArray Inputrange1 As Variant) 
As Variant

'Calcuations
End Function

This is my code, and Function2 I believe is not accepting the input.
:)
 
Last edited:
Upvote 0
should this line

Private Function PA_function2(ParamArray Inputrange1 As Variant)

not read

Private Function PA_function2(ParamArray Inputrange1() As Variant)
 
Upvote 0
Upvote 0
Code:
Function Firsttext2(ParamArray Inputrange() As Variant) As Variant
 
Firsttext2 = WFIFindNonblank("First", "Text", Inputrange())
End Function


Public Function FindNonblank(order As String, _
range_type As String, _
ParamArray Inputrange() As Variant) _
As Variant
Dim i, z, k, range_count, row_count, col_count As Integer
Dim end_row, begin_row, end_column, begin_column, begin_val, end_val, step  As Integer

Dim Rng As range
WFIFindNonblank = "something wrong"
'WFIFindNonblank = CVErr(xlErrNA)
range_count = UBound(Inputrange)
    
If order = "Last" Then
end_val = range_count
begin_val = 0
step = -1
    Else
end_val = 0
begin_val = range_count
step = 1
    End If
    
    
For z = end_val To begin_val Step step
    
    
    Set Rng = Inputrange(z)
    row_count = Rng.Rows.Count
    col_count = Rng.Columns.Count
   
Select Case order
Case "Last"
    end_row = row_count
    begin_row = 1
    end_column = col_count
    begin_column = 1
 
  
Case "First"
    end_row = 1
    begin_row = row_count
    end_column = 1
    begin_column = col_count
    
End Select
     
     For i = end_row To begin_row Step step
        For k = end_column To begin_column Step step
       
       
          If IsNumeric(Rng(i, k)) And Not IsEmpty(Rng(i, k)) And range_type = "Number" Then
            FindNonblank = Rng(i, k)
            Exit Function
     
     Else
     
    
             If TypeName(Rng(i, k).Value) = "String" And range_type = "Text" Then
              FindNonblank = Rng(i, k)
              Exit Function
         
              End If
              
           End If
        
        Next k
                  
    Next i
     
Next z

End Function
 
Upvote 0

Forum statistics

Threads
1,203,453
Messages
6,055,530
Members
444,794
Latest member
HSAL

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