Black Mamba
Black Mamba

Reputation: 245

Cut and paste content to next unknown named sheet

I want cut some lines of my activesheet and paste it to the next sheet. But i will never know the name of the next sheet.

Tried it:

Range("1:26").Cut After:=ActiveSheet

Thank you.

Upvotes: 0

Views: 30

Answers (2)

Gary's Student
Gary's Student

Reputation: 96753

Consider:

Sub cutandpaste()
    Dim r1 As Range, r2 As Range
    
    Set r1 = ActiveSheet.Range("1:26")
    Set r2 = ActiveSheet.Next.Range("1:26")
    
    r1.Cut r2
End Sub

or:

Sub another()
    With ActiveSheet
        .Range("1:26").Cut .Next.Range("1:26")
    End With
End Sub

Upvotes: 1

FaneDuru
FaneDuru

Reputation: 42236

Range("1:26").Cut Worksheets(ActiveSheet.Index + 1).Range("A1")

or

Range("1:26").Cut Worksheets(ActiveSheet.Index + 1).Range("1:26")

if you want moving them in the same position...

Upvotes: 1

Related Questions