chuckjitsu
New Member
- Joined
- Apr 24, 2015
- Messages
- 48
- Office Version
- 365
- 2016
I created a Dictionary via late binding and along with the key value, it contains seven other columns/sets of values that I added via a class module. That part worked fine and I was able to add the values I wanted. A sample of the output is below. The values in V1-V7 columns are other key values in the dictionary. What I'm attempting to do via the code snippet below is assign the value associated with V1 to a variable, check and see if that key exists, and delete it if it does. So using the first row as an example, I would be assigning the V1 value of J1:J5 to a variable, checking to see if that key exists in the dictionary and deleting it if it does.
I thought that would be straightforward, but I was clearly wrong as I keep getting a 424 run time error with the line vremove1 = dict5(key).V1 being the problem as it is highlighted on the debugger. Thanks in advance for the help as I've struggled with this. For brevity sake I left out the other part of the code (Dim statements, dictionary creation, etc.) and just included the part that fails, as seen below.
I thought that would be straightforward, but I was clearly wrong as I keep getting a 424 run time error with the line vremove1 = dict5(key).V1 being the problem as it is highlighted on the debugger. Thanks in advance for the help as I've struggled with this. For brevity sake I left out the other part of the code (Dim statements, dictionary creation, etc.) and just included the part that fails, as seen below.
KEY V1 V2 V3 V4 V5 V6 V7 A1:E1 J1:J5 F10:J10 A6:A10 A1:A5 A10:E10 J6:J10 F1:J1 B1:F1 J2:J6 E10:I10 A5:A9 A2:A6 B10:F10 J5:J9 E1:I1 C1:G1 J3:J7 D10:H10 A4:A8 A3:A7 C10:G10 J4:J8 D1:H1 D1:H1 J4:J8 C10:G10 A3:A7 A4:A8 D10:H10 J3:J7 C1:G1 E1:I1 J5:J9 B10:F10 A2:A6 A5:A9 E10:I10 J2:J6 B1:F1 F1:J1 J6:J10 A10:E10 A1:A5 A6:A10 F10:J10 J1:J5 A1:E1
VBA Code:
For Each key In dict5.Keys
vremove1 = dict5(key).V1
If dict5.Exists(vremove1) Then
dict5.Remove vremove1
End If
Next key
Exit Sub