Hi all,
I'm using the following code
It basically finds unique numbers in one column, and then transposes them to another sheet. This part works exactly as I want, though I appreciate there may be better ways of doing it.
I'm having trouble implementing this code on a different workbook. For context, this code is running on a daily report - I need the code to be contained within a different workbook that accesses the daily report and runs this code on it.
I've tried the usual Workbooks.Open("FilePath") and .Activate. I even tried insterting With and End With which I recently learned about thanks to this forum (though I may have used it incorrectly).
Anything I'm obviously doing wrong here?
I'm using the following code
VBA Code:
Sub EmpNumFind()
'Finds unique numbers and pastes them to Sheet1
Sheet1.Range("A:A").AdvancedFilter xlFilterCopy, , Sheet2.Range("A1:A1"), True
Sheet2.Range("A:A").ClearFormats
Sheet2.Columns("A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
'Copy and Transpose
Sheet2.Range("A2", Range("A2").End(xlDown)).Copy
Sheet2.Range("A1").PasteSpecial Transpose:=True
Sheet2.Range("A2", Range("A2").End(xlDown)).Clear
End With
End Sub
It basically finds unique numbers in one column, and then transposes them to another sheet. This part works exactly as I want, though I appreciate there may be better ways of doing it.
I'm having trouble implementing this code on a different workbook. For context, this code is running on a daily report - I need the code to be contained within a different workbook that accesses the daily report and runs this code on it.
I've tried the usual Workbooks.Open("FilePath") and .Activate. I even tried insterting With and End With which I recently learned about thanks to this forum (though I may have used it incorrectly).
Anything I'm obviously doing wrong here?