Command Control-cut range from one sheet to another sheet in same workbook

nathanzumbaugh

New Member
Joined
Jan 7, 2009
Messages
9
I haven't seen a post with this specific question yet.

I am trying to use a command control click button to:
1-cut range of cells from one sheet to another sheet
2-this range would be inserted into the destination sheet below a specific named cell in the next available row

Here is the current VBA:
----
Private Sub CommandButton1_Click()
Worksheets("gjswork").Range("d4:l4").Copy Worksheets("summary").Range("d4:l4")
Worksheets("gjswork").Range("d4:l4").ClearContents

End Sub
-----
There will obviously need to be some lines added to accomplish the requirement of adding the data below a certain cell with a name.
The selected data would be put under the cell on sheet Summary below the cell named gjssum, starting in D8.

I apologize in advance for errors in this post submission.
1715615447317.png

1715615644010.png
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Perhaps something like this.
VBA Code:
Private Sub CommandButton1_Click()
    Dim Ofs As Long
    
    With Worksheets("summary")
        If .Range("gjssum").Value = vbNullString Then
            Ofs = 0
        Else
            Ofs = .Cells(.Rows.Count, .Range("gjssum").Column).End(xlUp).Row - .Range("gjssum").Row + 1
        End If

        Worksheets("gjswork").Range("d4:l4").Copy .Range("gjssum").Offset(Ofs)
    End With

    Worksheets("gjswork").Range("d4:l4").ClearContents
End Sub

(Tip: For future posts , please try to use code tags like I did above when posting code. It makes your code easier to read and copy.
)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top