Dynamic Array

CPAExcelGuy

New Member
Joined
Jul 6, 2016
Messages
1
Hello,

I'm interested in creating a dynamic array. Essentially, I have a list of locations, and I would like that list of locations to populate into a subsequent list whenever someone places an "x" next to it. Like in the table below. Can someone please help?
LocationsPlace an "X"Locations to Populate
ChicagoX1Chicago
Los Angeles2New York
Dallas3
New YorkX4
Nashville

<tbody>
</tbody>
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Sub Macro2()
Dim lngLastRow As String
Dim lastRow As Long
Dim lastcolumn As Long
Dim j As Long
j = 2
Columns("D:E").Select
Selection.ClearContents
lastRow = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
For i = 2 To lastRow
If Cells(i, 2).Value = "X" Then
Cells(j, 5).Value = Cells(i, 1).Value
Cells(j, 4).Value = j - 1
j = j + 1
End If
Next
End Sub

you might want to run this macro eachtime, as private macos are not possible in this case.
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,581
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top