[Solved] How to write VBA code to copy the cell data based on the selection of the rows and columns [closed]


it’d be something like follows:

Sub MyMacro()
    With Selection
        Sheets.Add.name = .Cells(1, 1)
        .Offset(1).Resize(.Rows.Count - 1).Copy Sheets(.Cells(1, 1).value).Range("A1")
    End With
End Sub

feel free to add all necessary checks for assure error handling (e.g.: no selection made, only 1 row selected, target sheet already existent, …) of which you may find dozens of examples around here

4

solved How to write VBA code to copy the cell data based on the selection of the rows and columns [closed]