Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Passing Arrays to a Sub

I have an array of strings (sIssue) made up of different strings concatanated
together. The way sIssue will be constructed will be used repeatedly in my
program so what I would like to do is write a subroutine to construct this
array for the main program. I'm just not sure how to do this. I would like
for the code to work something like below

Sub Main()

' Do stuff
dim sIssue (1 to 8) as string

GetString(sIssue())

Range("B1").Select
for i = 1 to 8
ActiveCell.Offset(i,0).Value = sIssue(i)
next

End
-----------------
sub GetString(Byval sIssue as string)

' do stuff
for i = 1 to 8
sIssue(i) = ActiveCell.Offset(i,0) & ActiveCell.Offset(i,2)
next
End

Thanks in advance

end sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Passing Arrays to a Sub

Sub Main()
' Do stuff
dim sIssue As Variant
sIssue = GetString()

For i = 1 to 8
Cells(i,"B").Value = sIssue(i)
Next
End Sub

Private Function GetString() As Variant
' do stuff
for i = 1 to 8
GetString(i) = ActiveCell.Offset(i,0) & ActiveCell.Offset(i,2)
Next
End Function



--
__________________________________
HTH

Bob

"Brad" wrote in message
...
I have an array of strings (sIssue) made up of different strings
concatanated
together. The way sIssue will be constructed will be used repeatedly in my
program so what I would like to do is write a subroutine to construct this
array for the main program. I'm just not sure how to do this. I would like
for the code to work something like below

Sub Main()

' Do stuff
dim sIssue (1 to 8) as string

GetString(sIssue())

Range("B1").Select
for i = 1 to 8
ActiveCell.Offset(i,0).Value = sIssue(i)
next

End
-----------------
sub GetString(Byval sIssue as string)

' do stuff
for i = 1 to 8
sIssue(i) = ActiveCell.Offset(i,0) & ActiveCell.Offset(i,2)
next
End

Thanks in advance

end sub




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 Type Arrays NateBuckley Excel Programming 2 September 4th 08 03:25 PM
Passing Arrays to SUBs Bill Martin[_3_] Excel Programming 4 October 27th 06 02:37 PM
Passing arrays to VBA module Ralph K Excel Programming 1 November 20th 04 02:57 PM
passing arrays between functions in VBA Tom Ogilvy Excel Programming 3 March 1st 04 05:54 PM
Passing arrays to a subroutine Braden Craig Excel Programming 4 August 17th 03 05:54 PM


All times are GMT +1. The time now is 06:28 PM.

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"