Copy and paste macro

DagmaraB

New Member
Joined
Feb 21, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello, could someone please put me in the right direction as to what maybe wrong with this code. It was working fine but something must have happened overnight.
VBA Code:
Sub Move()
'
' Move Macro
'

'
    Range("Orders").Select
    Selection.Copy
    'find next free cell in destination sheet
    Dim NextFreeCell As Range
    Set NextFreeCell = ThisWorkbook.Worksheets("DATA").Cells(Rows.Count, "A").End(xlUp).Offset(1).Row

'copy&paste
    NextFreeCell.PasteSpecial xlPasteValuesAndNumberFormats
    With Range("A:A,C:C").NumberFormat = "General"
   End With
   
    
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
What do you expect this code to do, and what does it do instead? Be specific.

Also, nothing just "happens" overnight in code.
 
Upvote 0
What do you expect this code to do, and what does it do instead? Be specific.

Also, nothing just "happens" overnight in code.
It just copies the data from Orders tab but does not transfer it into the DATA tab. Error is with Set NextFreeCell
 
Upvote 0
The posted code doesn't compile.
You can't set a range to just a row number.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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