Forum Discussion
JB_SE_ED
Feb 27, 2023Copper Contributor
Need help with a VBA Macro for copying and pasting of rows.
Hello, My experience is fairly limited with Macro's, and even more so with VBA code (so please feel free to be as specific as possible). But I am building an automation flow that uses macro's in...
- Feb 27, 2023
Thank you, I downloaded the workbook. Try this version:
Sub Sample() Dim LastRow As Long LastRow = Range("A" & Rows.Count).End(xlUp).Row Range("F1:F" & LastRow).AutoFilter Field:=1, Criteria1:="2" Range("A2:F" & LastRow).Copy Destination:=Range("A" & LastRow + 1) Range("F1:F" & LastRow).AutoFilter Field:=1 End Sub
HansVogelaar
Feb 27, 2023MVP
Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
- JB_SE_EDFeb 27, 2023Copper Contributor
HansVogelaar I've attached a sample file below. There should only be one Macro in the workbook named "Sample". That's what i'm trying to run. https://schneiderelectric-my.sharepoint.com/:x:/r/personal/sesa503977_se_com/Documents/Misc/VBA%20Sample.xlsm?d=w49c864a7ef6f4461a41ddd0da3c4341c&csf=1&web=1&e=lJ8VWx
- HansVogelaarFeb 27, 2023MVP
I don't have access to your SharePoint. Can you share the file?
- JB_SE_EDFeb 27, 2023Copper ContributorHansVogelaar I couldn't find a way to link the file to the reply, but it allowed me to message it to you. Let me know if you have any trouble accessing it that way.