Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Call other sub in the same module


Dear all,

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

Dim LibraryList(20) As String 'I want to use LibraryList(20) as
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.

Davi

--
yangy
-----------------------------------------------------------------------
yangyh's Profile: http://www.excelforum.com/member.php...fo&userid=2688
View this thread: http://www.excelforum.com/showthread.php?threadid=46657

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



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
macro in excel to call a access module to run. [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 08:59 PM
to call procedure in a worksheet in a module CAPTGNVR Excel Discussion (Misc queries) 4 January 30th 07 09:39 PM
how to call Access's function in different module in Excel VBA miao jie Excel Programming 0 July 25th 04 04:03 AM
how to call Access function&module in Excel VBA?? miao jie Excel Programming 1 July 24th 04 04:49 PM
Call Private Function from ThisWorkbook module Beto[_3_] Excel Programming 3 February 25th 04 01:36 PM


All times are GMT +1. The time now is 01:45 AM.

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

About Us

"It's about Microsoft Excel"