I was using this script and it was working just up until the other day. Nothing changed and it kept giving an error. Dates are exactly how it's supposed to be.
When I decode it, it highlights this line. No idea why. I'm a noob. Help? Thank you.
Full script provided by Peter_SSs
When I decode it, it highlights this line. No idea why. I'm a noob. Help? Thank you.
VBA Code:
b(cr(1), cr(0)) = Format(a(i, 1), "mm/dd/yyyy") & vbLf & Join(Application.Index(a, i, Array(2, 3, 4)), vbLf)
Full script provided by Peter_SSs
VBA Code:
Sub Rearrange()
Dim a As Variant, b As Variant, cr As Variant
Dim d As Object
Dim i As Long, lr As Long
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = 1
With Sheets("Sheet2")
lr = .Range("B" & Rows.Count).End(xlUp).Row
a = Application.Index(.Cells, Evaluate("row(2:" & lr & ")"), Array(5, 2, 4, 3))
End With
ReDim b(1 To UBound(a), 1 To UBound(a))
For i = 1 To UBound(a)
If Not d.exists(a(i, 3)) Then d(a(i, 3)) = d.Count + 1 & " 1"
cr = Split(d(a(i, 3)))
b(cr(1), cr(0)) = Format(a(i, 1), "mm/dd/yyyy") & vbLf & Join(Application.Index(a, i, Array(2, 3, 4)), vbLf)
d(a(i, 3)) = cr(0) & " " & cr(1) + 1
Next i
With Sheets("Sheet1")
With .Range("A2").Resize(UBound(a), d.Count)
.WrapText = True
.Value = b
.Rows(0).Value = d.Keys
End With
End With
End Sub