Having an Issue Updating my Array

CSM1

New Member
Joined
Apr 15, 2021
Messages
2
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi everyone, just started using VBA again after some brief exposure in college and I'm looking for some advice. I would like to have one array that references the location of a group of cells, and another array that references the location of another, smaller group of cells. I've been referring to the smaller group as the roster, because the contents of these cells will be copied to into the larger array, and will only exist temporarily in the roster. I would like the user to be able to choose which element of the roster to use in order to fill an array position. I would also like the user to be able to clear the contents of any of the cells associated with a given element of the larger array.

I would like the larger array to update in a dynamic way, and this is what I'm struggling with. For example, say there are 8 positions in the larger array. All 8 of them are filled with content received from the roster. The user would like to clear the content in the second position of the larger array. I want the file to then fill in the gap left in position 2, so positions 3 though 8 would be shifted to positions 2 though 7 and position 8 would now be empty.



The code below is very incomplete, just declaring some stuff. Just included it in case it helps to clarify in any way. The image may help idk, its not the actual sheet, just a way for me to mess around with stuff on a smaller and less messy scale. Thanks!
 

Attachments

  • Picture1.png
    Picture1.png
    18.5 KB · Views: 5

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
The basic code that I forgot to upload:


Sub AssignArray()

Dim Arr(1 To 8) As Variant
Dim Roster(1 To 3) As Variant
Dim LongRoster As Variant
Dim ShortRoster As Variant
Dim NoPositionRoster As Variant

'assignRoster
Roster(1) = Range("P6:Q8").Address
Roster(2) = Range("P9:Q11").Address
Roster(3) = Range("P12:Q113").Address


'assign first array to first location1
Arr(1) = Range("D8").Address


'assign Array 2
Arr(2) = Range("F8").Address


'assign Array 3
Arr(3) = Range("H8").Address


'assign Array 4
Arr(4) = Range("J8").Address





End Sub
Sub ExitPosition()

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

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