ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing range as an argument in a function (https://www.excelbanter.com/excel-programming/301455-passing-range-argument-function.html)

Hari[_3_]

Passing range as an argument in a function
 
Hi,

I want to pass the values of an array in to a function. Please tell me how
to do it.

Here is my Array which is reading values from a sheet called sheet1

For n = 2 To 20
empclass(n - 2) = UCase(Sheets("sheet1").Cells(n, 251))
Next n


The function is already accepting lots of other values :-

Public Function Validate(ByVal sheetName As String, a As Integer, ByVal b As
Integer, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f
As Integer, ByVal g As Integer, ByVal h As Integer) As Integer

Please tell me how I should define the empclass as one more argument in the
function.

Regards,
Hari
India



Vasant Nanavati

Passing range as an argument in a function
 
Untested, but:

ByRef empclass() As String

should work.

--

Vasant

"Hari" wrote in message
...
Hi,

I want to pass the values of an array in to a function. Please tell me how
to do it.

Here is my Array which is reading values from a sheet called sheet1

For n = 2 To 20
empclass(n - 2) = UCase(Sheets("sheet1").Cells(n, 251))
Next n


The function is already accepting lots of other values :-

Public Function Validate(ByVal sheetName As String, a As Integer, ByVal b

As
Integer, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal

f
As Integer, ByVal g As Integer, ByVal h As Integer) As Integer

Please tell me how I should define the empclass as one more argument in

the
function.

Regards,
Hari
India






All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com