|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub A1233()
ActiveSheet.Copy After:=Sheets(Sheets.Count)
Dim xStr As String
Retry:
Err.Clear
xStr = InputBox("请输入工作表的新名称:" _
, "重命名工作表", ActiveSheet.Name)
If xStr = "" Then Exit Sub
On Error Resume Next
ActiveSheet.Name = xStr
If Err.Number <> 0 Then
MsgBox Err.Number & " " & Err.Description
Err.Clear
GoTo Retry
End If
On Error GoTo 0
'.........
Range("K4:K342").Copy
Range("G4:G342").PasteSpecial (xlPasteValues)
Application.CutCopyMode = xlCut
Range("H4:J27,H29:J47,H49:J51,H53:J54,H56:J58,H60:J61,H63:J64,H66:J67,H69:J70,H72:J94,H96:J115,H117:J120,H122:J128,H130:J133,H135:J142,H144:J155,H157:J162,H164:J170,H172:J174,H176:J177,H179:J180,H182:J183,H185:J187,H189:J196,H198:J199,H201:J208,H210:J211,H213:J214,H216:J218,H220:J225,H227:J228,H230:J231,H233:J234,H236:J236,H238:J239,H241:J244,H246:J247,H250:J283,H285:J292,H294:J295,H297:J298,H300:J301,H304:J304,H306:J310,H312:J313,H316:J323,H325:J327,H329:J331,H333:J336,H338:J339").Selection.ClearContents
End Sub 这是我建的宏! 在WPS上就能正常运行,在EXcel上前面步骤能正常运行 到最后的选定区域删除就报错(运行错误 1004 方法‘range’作用于对象‘_Global’时失败) 就算录制宏 单独选定多个不连续区域然后清除内容,也只能删除到第200行!! |
|