Help with Copy Function

Orphevs

New Member
Joined
Dec 7, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello. Would somebody be able to help please. I have a sheet in which the first 3 rows are headers and the data starts in A4. A variable number of rows starting in A4 will be completed. I would like to copy only the completed rows to a second sheet. When I run the code copied below, it is copying from the third row to the last completed row. Any ideas? Apologies, I am very new to this.

Thanks for the help!

VBA Code:
Private Sub CommandButton1_Click()
    Unload Me

'Define copy selection as 4th row to last completed row, columns A to AD (30)
    LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 30).End(xlUp).Row

'Load completed cases to the Log sheet on clicking "Yes"
    Sheets("Today's List").Range("A4", ActiveSheet.Cells(LastRow, 30)).Copy
    Sheets("Log").Cells(Rows.Count, "A").End(xlUp).Offset(1). _
        PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
   
'Clear the list
    ActiveWorkbook.Worksheets("Today's List").Range("B2").ClearContents
    ActiveWorkbook.Worksheets("Today's List").Range("A4:AD500").ClearContents
   
'Pop up response
    response = MsgBox("Cases Uploaded")

End Sub
 
Last edited by a moderator:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Not to worry, Google has solved it for me! Thanks anyway
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,957
Latest member
Hat4Life

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