L
L. Howard
GEN, COMM, MAJ etc. are dynamic named ranges on sheet 1, Workbook in scope.
Refers To formula looks like this:
=OFFSET(Sheet1!$T$2,0,0,COUNTA(Sheet1!$T$2:$T$50),1)
Each range has a header and four entries for testing but when working each will be a different number of rows.
I need them to list each range in column A starting at A2 and a one row space between each range.
The code here lists only the header of each named range in column A and no space between them.
I tried to put a Resize in the posting line but that did not work either, I just used 5 rows by 1 column but it too just posted the headers.
The commented out line did nothing.
I cannot remember the step I am missing to post the entire named range instead of just the header.
Thanks.
Howard
Sub RankArray()
Dim Rank_array(9)
Dim i As Long
Rank_array(0) = Range("GEN")
Rank_array(1) = Range("COMM")
Rank_array(2) = Range("MAJ")
Rank_array(3) = Range("CPT")
Rank_array(4) = Range("LT")
Rank_array(5) = Range("MSGT")
Rank_array(6) = Range("SGT")
Rank_array(7) = Range("CPL")
Rank_array(8) = Range("PVT")
For i = LBound(Rank_array) To UBound(Rank_array)
Range("A" & Rows.Count).End(xlUp)(2) = Rank_array(i)
'Range("A" & Cells(Rows.Count, "A").End(xlUp).Row) _
.End(xlUp)(2).Value = Rank_array(i)
Next 'i
End Sub
Refers To formula looks like this:
=OFFSET(Sheet1!$T$2,0,0,COUNTA(Sheet1!$T$2:$T$50),1)
Each range has a header and four entries for testing but when working each will be a different number of rows.
I need them to list each range in column A starting at A2 and a one row space between each range.
The code here lists only the header of each named range in column A and no space between them.
I tried to put a Resize in the posting line but that did not work either, I just used 5 rows by 1 column but it too just posted the headers.
The commented out line did nothing.
I cannot remember the step I am missing to post the entire named range instead of just the header.
Thanks.
Howard
Sub RankArray()
Dim Rank_array(9)
Dim i As Long
Rank_array(0) = Range("GEN")
Rank_array(1) = Range("COMM")
Rank_array(2) = Range("MAJ")
Rank_array(3) = Range("CPT")
Rank_array(4) = Range("LT")
Rank_array(5) = Range("MSGT")
Rank_array(6) = Range("SGT")
Rank_array(7) = Range("CPL")
Rank_array(8) = Range("PVT")
For i = LBound(Rank_array) To UBound(Rank_array)
Range("A" & Rows.Count).End(xlUp)(2) = Rank_array(i)
'Range("A" & Cells(Rows.Count, "A").End(xlUp).Row) _
.End(xlUp)(2).Value = Rank_array(i)
Next 'i
End Sub