Copy/Move Data from a table to another Sheet to a table

himaruasuka

New Member
Joined
May 26, 2022
Messages
12
Office Version
  1. 2013
Platform
  1. Windows
  2. Mobile
Good day everyone!

I am looking for help. I tried this code already and it is working but I have some problem with it.
It is successfully copy/move the data to another sheet but without using a 'table'.

I want to convert this code that can copy/move data to another sheet with a 'table'.
It can move the data but it copied in one row only.
I don't know what's wrong with the code.

Please help me~

Private Sub export_confirm_Click()

If export_passtxt = "himaru1989" Then

Selection.EntireRow.Copy

Worksheets("COMPLETE").Unprotect "utt"
LastRow = Sheets("COMPLETE").Cells(Rows.Count, 1).End(xlUp).Row + 1
ActiveSheet.Paste Destination:=Worksheets("COMPLETE").Range("a" & LastRow)
Worksheets("COMPLETE").Protect "utt"

Worksheets("ORDERS").Unprotect "utt"
Selection.EntireRow.Delete
'ActiveWorkbook.Save
Worksheets("ORDERS").Protect "utt"
Unload exportpassword
Exit Sub

Else
MsgBox "Password is incorrect!"
End If

End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I am looking for help.

Copy/Move Data from a table to another Sheet to a table

Try this:

VBA Code:
Private Sub export_confirm_Click()
  Dim newRow As ListRow
  
  If export_passtxt = "himaru1989" Then
    With Worksheets("COMPLETE")
      .Unprotect "utt"
        Set newRow = .ListObjects(1).ListRows.Add
        Selection.EntireRow.Copy .Range("A" & newRow.Range.Cells(1).Row)
      .Protect "utt"
    End With
    Worksheets("ORDERS").Unprotect "utt"
    Selection.EntireRow.Delete
    'ActiveWorkbook.Save
    Worksheets("ORDERS").Protect "utt"
    Unload exportpassword
    Exit Sub
  Else
    MsgBox "Password is incorrect!"
  End If
End Sub
 
Upvote 1
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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