View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Array with many cells from a row but not in order or together

Caution, code under construction by me.

How do I set the columns I want to vSrcCols once c has found the Input box ID number in aRng?

Sub myJQsheet()

Dim vSrcCols, vTgtCols, vTmp, n&
Dim vSrcCols As String
Dim Lrow As Long
Dim aRng As Range
Dim c As Range

Lrow = Sheets("JQ5027-Session1-Apr 23 17-32-03").Cells(Rows.Count, "A").End(xlUp).Row
aRng = Sheets("JQ5027-Session1-Apr 23 17-32-03").Range("A1:A" & Lrow)

vSrcCols = Split(sCopyFromCols, ",")
vTgtCols = Split(sCopyToCols, ",")

vSrcCols = InputBox("Enter an ID number.", "ID Search")
If vSrcCols = vbNullString Then Exit Sub

For Each c In aRng
If c = vSrcCols Then
vSrcCols = "C", "F", "P", "S", "D"&"E", "R", "M", "Y", "AA", "BM") ?????


Next

For n = LBound(vSrcCols) To UBound(vSrcCols)
vTmp = Split(vSrcCols(n), ":")
If Not LBound(vTmp) = UBound(vTmp) Then

'/** this needs to start at C4
Range("C" & k).Resize(UBound(MyArray) + 1, 1) = _
Application.Transpose(MyArray)

'process as a range
Else
'process as a single cell
End If
Next 'n

'..where vTmp is ALWAYS used when you know you have a range to work
'with. As to how to manage putting the data into a single cell...

rngTgt = Join(vTmp)
'OR
rngTgt = Join(vTmp, " ")

'..where the 1st line puts a space by default, and the 2nd line
'specifies the delimiter to use.
End Sub