ByRef Array Button Click

LePig

New Member
Joined
Aug 30, 2016
Messages
16
Hi,

I am trying to pass an array generated on one button click to a subroutine button click. For example

Code:
Private Sub Retrieve_Attendance_click(ByRef LArrayDatesOfPay() As String)Dim todays_date_from As Variant
Dim todays_date_to As Variant
Dim rowNumSubmit As Range
'Dim LArrayDatesOfPay() As String
Dim txtB1 As Control
Dim myrow_10() As Integer
'Main.Hide
'Submit_Wages.Retrieve_Attendance.Visible = False
Call PopulateArrayEmployed
todays_date_from = Me.Date_Picker_Wages_Start_Date.Value
todays_date_to = Me.Date_Picker_Wages_End_Date.Value
x = 1


For Each rowNumSubmit In ThisWorkbook.Worksheets("Input Take Sheet").Range("Input_take_table[Date]").Rows
    ReDim Preserve myrow_10(x)
    myrow_10(x) = rowNumSubmit.row - 1
 If ThisWorkbook.Worksheets("Input Take Sheet").Range("Input_take_table[Date]").Rows(myrow_10(x)).Value >= todays_date_from _
    And ThisWorkbook.Worksheets("Input Take Sheet").Range("Input_take_table[Date]").Rows(myrow_10(x)).Value <= todays_date_to Then
    
    ReDim Preserve LArrayDatesOfPay(x)
    LArrayDatesOfPay(x) = ThisWorkbook.Worksheets("Input Take Sheet").Range("Input_take_table[Date]").Rows(myrow_10(x)).Value


    x = x + 1
    
    End If
    
Next

and then

Code:
Private Sub Wages_Submit_Click()Dim LArrayDatesOfPay() As Date


Call Retrieve_Attendance_click(LArrayDatesOfPay)
MsgBox UBound(LArrayDatesOfPay)


End Sub

But it keeps coming up with a compile error Procedure declaration does not match description of event or procedure having the same name error.

Any help would be greatly appreciated.

Kind Regards
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Also posted here http://www.vbaexpress.com/forum/showthread.php?64572-ByRef-Array-Button-Click

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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