Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FUNCTION TO COPY STRING ARRAY !!
Hi -
I am looking for a vba function, copyArray()of type String, that will take in one String array, and produce a copy of the input. Specs: (1)The function should be able to take in either 1D or 2D string array, and produce its copy. (2)If the input is just "" or vbNullString, the output should be the same as well. Any help will be appreciated! Thanks Jay Dean *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FUNCTION TO COPY STRING ARRAY !!
Sub test()
Dim i As Long Dim arrString1(0 To 10) As String Dim arrString2() As String For i = 0 To 10 arrString1(i) = Chr(i + 65) Next i 'copy the array arrString2 = arrString1 For i = 0 To 10 MsgBox arrString2(i) Next i End Sub RBS "jay dean" wrote in message ... Hi - I am looking for a vba function, copyArray()of type String, that will take in one String array, and produce a copy of the input. Specs: (1)The function should be able to take in either 1D or 2D string array, and produce its copy. (2)If the input is just "" or vbNullString, the output should be the same as well. Any help will be appreciated! Thanks Jay Dean *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
FUNCTION TO COPY STRING ARRAY !!
On Sun, 19 Jul 2009 14:05:48 -0700, jay dean wrote:
Hi - I am looking for a vba function, copyArray()of type String, that will take in one String array, and produce a copy of the input. Specs: (1)The function should be able to take in either 1D or 2D string array, and produce its copy. (2)If the input is just "" or vbNullString, the output should be the same as well. Any help will be appreciated! Thanks Jay Dean *** Sent via Developersdex http://www.developersdex.com *** If your function argument is a variant, and it's output is a variant, you can just set the input equal to the output. e.g.: ========================== Function CopyStringArray(s1) CopyStringArray = s1 End Function ========================= If you need to, you can cycle through each element of the array to ensure it is of type String. You can also test to see if it is an array. --ron |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
FUNCTION TO COPY STRING ARRAY !!
Thanks, Ron! I think using the variant datatype even though uses more
memory would suffice for this purpose. I am trying to keep loops to a minimum so your approach works well. Jay Dean *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
FUNCTION TO COPY STRING ARRAY !!
On Sun, 19 Jul 2009 19:55:53 -0700, jay dean wrote:
Thanks, Ron! I think using the variant datatype even though uses more memory would suffice for this purpose. I am trying to keep loops to a minimum so your approach works well. Jay Dean *** Sent via Developersdex http://www.developersdex.com *** Glad to help. Thanks for the feedback. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problems Loading Large String Array into Array variable | Excel Programming | |||
Using a 2 dimensional string array variable like a lookup function | Excel Programming | |||
Function (array argument, range argument, string argument) vba | Excel Programming | |||
Passing a String in Array to Range as String | Excel Programming | |||
Return string array from function in excel 97 | Excel Programming |