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?
[TABLE="width: 500"]
<tbody>[TR]
[TD]Locations[/TD]
[TD]Place an "X"[/TD]
[TD][/TD]
[TD][/TD]
[TD]Locations to Populate[/TD]
[/TR]
[TR]
[TD]Chicago[/TD]
[TD]X[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]Chicago[/TD]
[/TR]
[TR]
[TD]Los Angeles[/TD]
[TD][/TD]
[TD][/TD]
[TD]2[/TD]
[TD]New York[/TD]
[/TR]
[TR]
[TD]Dallas[/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]New York[/TD]
[TD]X[/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Nashville[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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,223,632
Messages
6,173,469
Members
452,516
Latest member
archcalx

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