Hello,
I'm having one of those days where I can't seem to see the minor error that is completely stopping my entire workflow. Whenever I run the following code, I get an "Object does not support this property or Method" on the "Template.Sheets(1).Range("A1").Paste" line at the bottom.
I'm having one of those days where I can't seem to see the minor error that is completely stopping my entire workflow. Whenever I run the following code, I get an "Object does not support this property or Method" on the "Template.Sheets(1).Range("A1").Paste" line at the bottom.
Code:
ScreenUpdating = False
Dim RawData As Workbook, Template As Workbook
Set RawData = ActiveWorkbook
Set Template = Workbooks("TEMPLATE for Samples Monthly Numbers .xlsm")
Rows("1:2").Delete Shift:=x2Up
Columns("D:D").Cut
Columns("A:A").Insert Shift:=xlToRight
Columns("B:B").TextToColumns Destination:=Range("B1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 3), Array(11, 9)), TrailingMinusNumbers:=True
Columns("C:C").Select
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(0, 3), TrailingMinusNumbers:=True
Columns("D:D").Select
Selection.TextToColumns Destination:=Range("D1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(0, 3), TrailingMinusNumbers:=True
Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Value = "Unique PO ID"
Range("B1").Copy
Range("A1").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
'Loop to give each order line a unique PO ID
Dim i As Integer
i = 1
Do Until Cells(1 + i, 2) = ""
Cells(1 + i, 1).Value = i
i = i + 1
Loop
Template.Worksheets("Paste Raw Data Here").UsedRange.Clear
RawData.Sheets(1).UsedRange.Copy
Template.Sheets(1).Range("A1").Paste
Application.CutCopyMode = False
Calculate
ScreenUpdating = True