Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble Passing An Array
I've tried to pass the array multiple times using different things, all
of which have returned a compile error. I'm not very familiar with VBA, is what I'm doing correct? Way off? Suggestions? The first sub creates the array, the 2nd sub recieves it, and the 3rd sub fires the first 2 arrays in order. I get the compile error on the 3rd sub. ------------------------------------------------------------------------------ Sub NewCalcSheet() Dim ends(20) As Integer Dim c2(5) As Integer Dim ab For d = Sheet11.Cells(18, 14).Value - 1 To 0 Step -1 'Large Amount of Code Left out 'Large Amount of Code Left out 'Large Amount of Code Left out ends(ab) = Range("A50000").End(xlUp).Row ab = ab + 1 Next d 'end stud loop c() = ends() ReDim Preserve c(Sheet11.Cells(18, 14).Value - 1) Button38_Click c End Sub ------------------------------------------------------------------------------ Sub Button38_Click(ByRef c()) End Sub ------------------------------------------------------------------------------ Sub CommandButton1_Click() Sheet14.Select CreateCalcSheetArray.NewCalcSheet 'Do Stuff "Calc Table" Sheet11.Select PrintArea.Button38_Click (c) 'COMPILE ERROR HERE End Sub ------------------------------------------------------------------------------ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble Passing An Array
Still no luck...
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble Passing An Array
GOT IT!
Create Button38_Click c() Call Dim po As Integer, dummy As Integer For po = 1 To 2 dummy = c(po) Next po Call Functions PrintArea.Button38_Click c() |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble Passing An Array
Keith,
Several things wrong that I can see. First is it c or c2 you want to pass. Second, you can not copy array by =. Third, in CommandButton1_Click where does "c" come from? I alway use Option Explicit to flush out variable name typos. Ed *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing array from 2nd sub back to first sub | Excel Programming | |||
Need help passing an array as an argument | Excel Programming | |||
VBA passing vector from spreadsheet to array | Excel Programming | |||
PASSING an array to a sub in VBA | Excel Programming | |||
Passing array to a function | Excel Programming |