Creating a simple array challenge!
Creating a simple array challenge!
(OP)
I am new to VB, and I have a question. I want to create an array from a range of cells, starting at C9 and using the xldown to go to the last nonblank cell to grab my array. Then, I would like to make the array be listed in two ways: if the number of cells is 1 (C9 only), it would only list C9. If it is more than 1, then the array would be resolved as "C9 + Chr(13) + Chr(10) + next cell" and loop through until the array is filled. Does anyone have any ideas on how this could properly be set up with a for/next statement? Will I need an If Then statement nested within the For/Next? Your input would be greatly appreciated.





RE: Creating a simple array challenge!
http://virtualpipeline.spaces.msn.com
RE: Creating a simple array challenge!
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Creating a simple array challenge!
CODE
firstrow = 9
firstcol = 3
a = firstrow
Do
'mystring = mystring & vbCrLf & Cells(a, firstcol).Value
mystring = mystring & vbCrLf & Chr$(64 + firstcol) & CStr(a)
a = a + 1
Loop Until IsEmpty(Sheets(1).Cells(a, firstcol).Value)
Debug.Print mystring
End Sub
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints
RE: Creating a simple array challenge!