I'm working on a recorded macro that will execute the same action to a lot of similar sheets. If works neatly for the sheet i recorded it on, however, when i try it on other workbooks it doesn't work. Here's a piece of the code, basically it copies the first column, pastes on a new sheet, removes duplicates and gets the first 6 numbers:
Sub Macro2()
ActiveSheet.Select
Columns("A:A").Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count).Select
Columns("A:A").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
ActiveSheet.Range("$A:$A").RemoveDuplicates Columns:=1, Header:=xlNo
Range("B2").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],6)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B14")
Range("B2:B14").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Selection.Insert Shift:=xlToRight
Range("D8").Select
End Sub
I know it doesn't look good, I'm still learning. I don't get it why it doesn't work on other sheets if it looks so simple.