sanantonio
Board Regular
- Joined
- Oct 26, 2021
- Messages
- 124
- Office Version
- 365
- Platform
- Windows
Hi All,
Written a simple copy and paste macro. It transfers data from a table to a specific area. There's several columns to copy and paste and they all function apart from two.
100% the column names match!
Code is this:
It's the "Copies Old $" and "Copies New $" that it struggling with. I've tried renaming the columns, I've tried having the data copy to different columns within the table. But it's just debugs on it everytime. This is the error I get.
These are the columns it's trying to copy:
They're formatted as "General".
Any ideas from y'all?
Written a simple copy and paste macro. It transfers data from a table to a specific area. There's several columns to copy and paste and they all function apart from two.
100% the column names match!
Code is this:
VBA Code:
Sub testing()
'Copies Order Area
Worksheets("PCM").Select
Range("Memos[Order Area]").Select
Selection.Copy
Worksheets("PPC").Select
Range("B8").Select
ActiveSheet.Paste
'Copies Price Change Set
Worksheets("PCM").Select
Range("Memos[Price Change Set]").Select
Selection.Copy
Worksheets("PPC").Select
Range("C8").Select
ActiveSheet.Paste
'Copies Trend
Worksheets("PCM").Select
Range("Memos[Trend]").Select
Selection.Copy
Worksheets("PPC").Select
Range("D8").Select
ActiveSheet.Paste
'Copies Item Nr
Worksheets("PCM").Select
Range("Memos[Article]").Select
Selection.Copy
Worksheets("PPC").Select
Range("E8").Select
ActiveSheet.Paste
'Copies Item Desc
Worksheets("PCM").Select
Range("Memos[Item Description]").Select
Selection.Copy
Worksheets("PPC").Select
Range("F8").Select
ActiveSheet.Paste
'Copies store
Worksheets("PCM").Select
Range("Memos[Store]").Select
Selection.Copy
Worksheets("PPC").Select
Range("G8").Select
ActiveSheet.Paste
'Copies Price Zone
Worksheets("PCM").Select
Range("Memos[Zone]").Select
Selection.Copy
Worksheets("PPC").Select
Range("H8").Select
ActiveSheet.Paste
'Copies Old $
Worksheets("PCM").Select
Range("Memos[Price Old").Select
Selection.Copy
Worksheets("PPC").Select
Range("I8").Select
ActiveSheet.Paste
'Copies New $
Worksheets("PCM").Select
Range("Memos[Price New").Select
Selection.Copy
Worksheets("PPC").Select
Range("J8").Select
ActiveSheet.Paste
'Copies Valid From
Worksheets("PCM").Select
Range("Memos[Valid From]").Select
Selection.Copy
Worksheets("PPC").Select
Range("K8").Select
ActiveSheet.Paste
End Sub
It's the "Copies Old $" and "Copies New $" that it struggling with. I've tried renaming the columns, I've tried having the data copy to different columns within the table. But it's just debugs on it everytime. This is the error I get.
These are the columns it's trying to copy:
They're formatted as "General".
Any ideas from y'all?