Feicstur,
Thanks for the new workbook.
I have updated/renamed both macros, and, assigned them to the two command buttons.
Detach workbook GetUniquesV3 SandboxRev1 w2 w3 A2A34 w1 ScriptingDictionary - Feicstur - EF983632 - SDG15.xlsm and run the GetUniquesV3 macro, and, or, the ClearCellV2 macro, by clicking on the two command buttons.
And, in both macros, the new code is using the actual worksheet names.
If you want to use the two macros in another workbook with the same worksheet names, you will have to assign the new macros to the two command buttons.
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
Option Explicit
Sub GetUniquesV3()
' stanleydgromjr, 01/28/2014, EF983632
Application.Run ("ClearCellV2")
Dim rng As Range, c As Range, k
Dim lr As Long, n As Long, sr As Long, i As Long, nc As Long
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
Set rng = Sheets("Global Parameters").Range("L56:L71,O56:O71")
For Each c In rng
If c <> "" Then
If Not .Exists(c.Value) Then
.Add c.Value, c.Value
End If
End If
Next
lr = Sheets("Unit 1 Consoles").Cells(Rows.Count, "Z").End(xlUp).Row
Set rng = Sheets("Unit 1 Consoles").Range("Z1:Z" & lr)
For Each c In rng
If c.Value <> 0 Then
If Not .Exists(c.Value) Then
.Add c.Value, c.Value
End If
End If
Next
k = Application.Transpose(Array(.keys))
End With
With Sheets("Master Tag Message List")
.Range("A2").Resize(UBound(k, 1), UBound(k, 2)) = k
lr = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A2:A" & lr).Sort key1:=.Range("A2"), order1:=1
n = Application.Ceiling(lr, 49)
nc = 1
sr = 51
For i = sr To n Step 49
nc = nc + 1
.Cells(2, nc).Resize(49).Value = .Cells(i, 1).Resize(49).Value
Next i
.Range("A" & sr & ":A" & n).ClearContents
.Activate
End With
End Sub
Option Explicit
Sub ClearCellV2()
' stanleydgromjr, 01/28/2014, EF983632
With Sheets("Master Tag Message List")
.Range("A2:C50").ClearContents
.Range("A2").Select
End With
End Sub
Before you use the macros with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm
Bookmarks