I'm hoping that somebody may be able to help me
I have data in columns E, F & G
I am attempting to modify some code that Fluff has written
Is the Key for the dictionary using the values in column E and the line of code below is offsetting to next column and adding the value that is in that cell to the dictionary
If it is and I have data in columns E, F & G can I use column E as the dictionary key, offset and add the data from the next two columns (F & G) to the dictionary (which are dates) then add to sheet 1 offsets as below.
I have tried this code but obviously it doesn't work, but it’s an example of what I would like to achieve hopefully
Any help is always appreciated
I have data in columns E, F & G
I am attempting to modify some code that Fluff has written
Is the Key for the dictionary using the values in column E and the line of code below is offsetting to next column and adding the value that is in that cell to the dictionary
VBA Code:
For Each Cl In .Range("E2", .Range("E" & Rows.Count).End(xlUp))
Dic(Cl.Value) = Array(Cl, Cl.Offset(, 1).Value)
If it is and I have data in columns E, F & G can I use column E as the dictionary key, offset and add the data from the next two columns (F & G) to the dictionary (which are dates) then add to sheet 1 offsets as below.
I have tried this code but obviously it doesn't work, but it’s an example of what I would like to achieve hopefully
Any help is always appreciated
VBA Code:
Sub Test()
Dim Cl As Range
Dim Dic As Object
Set Dic = CreateObject("scripting.dictionary")
With Sheets("Sheet2")
For Each Cl In .Range("E2", .Range("E" & Rows.Count).End(xlUp))
Dic(Cl.Value) = Array(Cl, Cl.Offset(, 1).Value)
Dic(Cl.Value) = Array(Cl, Cl.Offset(, 2).Value)' not sure if this will work
Next Cl
End With
With Sheets("Sheet1")
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
If Dic.Exists(Cl.Value) Then
Dic(Cl.Value) = Array(Cl, Cl.Offset(, 8).Value)' not sure if this will work
Dic(Cl.Value) = Array(Cl, Cl.Offset(, 9).Value)' not sure if this will work
End If
Next Cl
End With
End Sub