April 2006
Beginner
1114 pages
98h 16m
English
When creating a list from a range, use the Source argument to identify the range of cells to convert to a list. If Source contains only one cell, Excel creates a list out of the range of contiguous cells that contain data. For example, the following code creates a list out of all ranges of contiguous cells containing data that surround the cell C4:
Sub ListFromAdjoiningCells( )
Dim ws As Worksheet
Set ws = ActiveSheet
' Create a list from cells adjoining C4.
ws.ListObjects.Add xlSrcRange, ws.Range("C4"), , xlYes
End SubThe preceding code creates the list and uses the top row of the range as the column headings for the list.
Read now
Unlock full access