I am attempting to write a simple code to copy a selected row and export the data to a new workbook with the name from the first cell.
A B C D
1 Test1 1 2 3
2 Test2 4 5 6
So if I was to select Row 2 the macro would create a new workbook named "Test2" with the data from row 2
A B C D
2 Test2 4 5 6
I cant figure out how to make the Rows("1:1").Select to be reflective of the actual selected row like the Activecell.select function.
Thanks
Sub Macro1()
Rows("1:1").Select
Selection.Copy
Workbooks.Add
Rows("1:1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:="C:\Users\Book2.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End Sub
Bookmarks