View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Call other sub in the same module

Hi David,

Your code worked for me with the following:

Change:

CreateLibraryArray()


to:

CreateLibraryArray

Also, change:

LibraryList(Y) = Sheet(X).Name


to:

LibraryList(Y) = Sheets(X).Name



---
Regards,
Norman



"yangyh" wrote in
message ...

Dear all,

I want to call other sub in the same module. Here are my codes. Can you
help me point out the problem? Thanks.

Dim LibraryList(20) As String 'I want to use LibraryList(20) as a
global array

Sub CreateLibraryArray()
Y = 0
For X = 1 To Worksheets.Count
If InStr(Sheets(X).Name, "Library") 0 Then
LibraryList(Y) = Sheet(X).Name
Y = Y + 1
End If
Next X
End Sub

Sub NewSub()
Dim List1(20) As String
CreateLibraryArray() 'Can I call CreateLibraryArray()
here?
List1(10) = LibraryList(10)
...
End Sub

Thanks.

David


--
yangyh
------------------------------------------------------------------------
yangyh's Profile:
http://www.excelforum.com/member.php...o&userid=26883
View this thread: http://www.excelforum.com/showthread...hreadid=466575