Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Trouble Passing An Array

Still no luck...

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing array from 2nd sub back to first sub ExcelMonkey[_190_] Excel Programming 2 March 14th 05 06:09 PM
Need help passing an array as an argument blc[_3_] Excel Programming 3 August 4th 04 10:35 PM
VBA passing vector from spreadsheet to array curious Excel Programming 3 June 2nd 04 05:56 PM
PASSING an array to a sub in VBA Wombat[_2_] Excel Programming 2 November 30th 03 11:48 AM
Passing array to a function GB[_3_] Excel Programming 3 October 21st 03 09:59 AM


All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"