Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VBA Excel-Delete-无法在重叠选择上使用该命令_Excel_Vba - Fatal编程技术网

VBA Excel-Delete-无法在重叠选择上使用该命令

VBA Excel-Delete-无法在重叠选择上使用该命令,excel,vba,Excel,Vba,我试图对数据应用过滤器,并将过滤后的数据复制到其他工作表,并删除基本工作表中过滤后的行 我面临错误,因为“无法在重叠选择上使用命令” 当我尝试使用删除基本工作表中的筛选行时 specialcells(xlcelltypevisible).entirerow.delete Sheets("analysis").select Sourcecol=1 VCurrLength = cells(rows.count, sourcecol).end(clip).row Activeshe

我试图对数据应用过滤器,并将过滤后的数据复制到其他工作表,并删除基本工作表中过滤后的行

我面临错误,因为“无法在重叠选择上使用命令”

当我尝试使用删除基本工作表中的筛选行时

specialcells(xlcelltypevisible).entirerow.delete

Sheets("analysis").select
Sourcecol=1
VCurrLength = cells(rows.count, sourcecol).end(clip).row
Activesheet.range("$A$1:$W$"& VCurrLength).autofilter field:=7, criteria1:= "ZP"
Range ("A1").select
Selection.end(xldown).select
If selection.row<1000000 then
    Range("A2:w"& VCurrLength).specialcells(xlcelltypevisible).copy
    Sheets("temp").select
    Activesheet.paste
    
    Sheets("analysis").select
    Range("A2:w"& VCurrLength).specialcells(xlcelltypevisible).select
    Selection.entirerow.delete
Endif
工作表(“分析”)。选择
Sourcecol=1
VCurrLength=单元格(rows.count,sourcecol).end(clip).row
Activesheet.range($A$1:$W$”&VCurrLength)。自动筛选字段:=7,标准1:=“ZP”
范围(“A1”)。选择
选择。结束(xldown)。选择
If selection.row备份数据
选项显式
子backupdatea()
将成功视为布尔值
将wb设置为工作簿:设置wb=ThisWorkbook包含此代码的工作簿
将sws标注为工作表:设置sws=wb。工作表(“分析”)
变暗sLR长度:sLR=sws.Cells(sws.Rows.Count,“A”).End(xlUp).Row
尺寸srg As范围:设置srg=sws范围(“A1:W”和单反)
Application.ScreenUpdating=False
如果是sws.AutoFilterMode,则
sws.AutoFilterMode=False
如果结束
srg.AutoFilter字段:=7,标准1:=“ZP”
如果工作表function.Subtotal(103,srg.Cells.Resize(,1))>1,则
将dws标注为工作表:设置dws=wb。工作表(“临时”)
尺寸dcell作为范围
设置dcell=dws.Cells(dws.Rows.Count,“A”).End(xlUp).偏移量(1)
变暗frg As范围
设置frg=srg.Resize(srg.Rows.Count-1)。偏移量(1)_
.特殊单元格(xlCellTypeVisible)
复制数据单元
frg.EntireRow.Delete
如果sws不是活动表,则
sws,激活
如果结束
srg.单元格(1)。选择
成功=正确
如果结束
sws.AutoFilterMode=False
Application.ScreenUpdating=True
如果成功的话
MsgBox“数据更新”,vbInformation,“成功”
其他的
MsgBox“无可用更新”,VBE感叹号,“无”
如果结束
端接头

您可以共享完整的代码吗?您要删除的
范围似乎包含重叠的选择。在没有向我们展示实际相关代码的情况下,答案可能会有多深……在发布问题时,代码被遗漏了。为事业感到遗憾。现在请检查一下。提前谢谢。