I keep getting an error after copying several cells and pasting them as values with transpose. I have tried adjusting my code in a couple of different ways to stop it but I must be missing something because this is a simple copy and paste.
Set myBWb = ThisWorkbook
RecCount = 1
ImportFile = Dir(myStrPath & "\*.xpf")
Do While ImportFile <> ""
Set myAWb = Workbooks.OpenXML(myStrPath & "" & ImportFile)
myAWb.Sheets(1).UsedRange.Copy myBWb.Sheets(1).Cells(RecCount, 1)
myAWb.Close False
' Sheets("Process").Select
LastRow = Worksheets("Process").Range("s1")
Sheets("Import").Select
Range("K3:K19").Select
Application.CutCopyMode = False
Selection.Copy
'LastRow = Cells(LRow, "A").End(xlUp).Row
Worksheets("Process").Select
ActiveSheet.Cells(LastRow, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Range("T1:AJ1").Copy
Range("T2").Select
ActiveSheet.Cells(LastRow, 20).Select
Selection.Paste
The blue section is where it consistently fails. I have changed the code multiple times trying to determine the issue.
Thanks in advance for reviewing/responding.
Set myBWb = ThisWorkbook
RecCount = 1
ImportFile = Dir(myStrPath & "\*.xpf")
Do While ImportFile <> ""
Set myAWb = Workbooks.OpenXML(myStrPath & "" & ImportFile)
myAWb.Sheets(1).UsedRange.Copy myBWb.Sheets(1).Cells(RecCount, 1)
myAWb.Close False
' Sheets("Process").Select
LastRow = Worksheets("Process").Range("s1")
Sheets("Import").Select
Range("K3:K19").Select
Application.CutCopyMode = False
Selection.Copy
'LastRow = Cells(LRow, "A").End(xlUp).Row
Worksheets("Process").Select
ActiveSheet.Cells(LastRow, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Range("T1:AJ1").Copy
Range("T2").Select
ActiveSheet.Cells(LastRow, 20).Select
Selection.Paste
The blue section is where it consistently fails. I have changed the code multiple times trying to determine the issue.
Thanks in advance for reviewing/responding.