我在这一点上被我的代码难住了,我在应该在创建工作表后复制和粘贴所选范围的行处遇到这个通用错误,但它给了我这个令人沮丧的错误 - 我不知道我在这里做错了什么,拜托帮助伙计们,感谢所有帮助:)
Private Sub ExpBttn()
Dim WrkShtExists As Boolean
Dim Sht As Worksheet
Dim x As Integer
Dim TgtRngR As Range
Dim TgtRngB As Range
Dim TgtNme As String
Select Case Multi
Case MultiPage1.Value = 0
Set TgtRngR = Sheets("Tracker").Range("U2:Z19")
Set TgtRngB = Sheets("Tracker").Range("U21:Z26")
TgtNme = "P4PSoft"
Case MultiPage1.Value = 1
Set TgtRngR = Sheets("Tracker").Range("AB2:AG19")
Set TgtRngB = Sheets("Tracker").Range("AB21:AG26")
TgtNme = "P4PHard"
Case MultiPage1.Value = 2
Set TgtRngR = Sheets("Tracker").Range("AP2:AU19")
Set TgtRngB = Sheets("Tracker").Range("AP21:AU26")
TgtNme = "RCI"
Case MultiPage1.Value = 3
Set TgtRngR = Sheets("Tracker").Range("AI2:AN19")
Set TgtRngB = Sheets("Tracker").Range("AI21:AN26")
TgtNme = "RCDI"
End Select
Sheets.Add.Name = "Exported_" & TgtNme
Sheets("Tracker").Range("TgtRngR").Copy Destination:=Sheets("Exported_" & TgtNme).Range("A1:F18")
Sheets("Tracker").Range("TgtRngB").Copy Destination:=Sheets("Exported_" & TgtNme).Range("A20:F25")
Sheets("Exported_" & TgtNme).Range("A1:F18") = Sheets("Tracker").Range("TgtRngR").Value
Sheets("Exported_" & TgtNme).Range("A20:F25") = Sheets("Tracker").Range("TgtRngB").Value
Sheets("Exported_" & TgtNme).Select
ActiveSheet.Columns("A:F").AutoFit