Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing Type Arrays | Excel Programming | |||
Passing Arrays to SUBs | Excel Programming | |||
Passing arrays to VBA module | Excel Programming | |||
passing arrays between functions in VBA | Excel Programming | |||
Passing arrays to a subroutine | Excel Programming |