VBA删除单元格低于上一个粘贴范围

问题描述 投票:0回答:1
Sheets("MDCF").Select
Range("B6:B100").Select
Selection.Copy
Range("J6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
Application.CutCopyMode = False
Selection.Replace What:="10000", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Range("J6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("MDCF Fund").Select
Range("F7").Select
ActiveSheet.Paste

With Sheets("MDCF Fund")
        Set FOUNDRANGE = .Columns("F:F").Find("*", After:=.Range("F81"), searchdirection:=xlPrevious, 
  LookIn:=xlValues)
        If Not FOUNDRANGE Is Nothing Then LR1 = FOUNDRANGE.Row
End With
    Range("F80:F" & LR1 + 1).Select
Selection.Clear

我正在尝试删除新工作表中最后一个单元格以下的单元格,但是如果两个复制粘贴范围中的单元格范围相同,则该单元格将不起作用。试图找到一种方法,使我只能删除F80以上和复制的单元数以下的冗余单元。

excel vba delete-row
1个回答
0
投票

如果您想立即删除F80之后的所有数据,则下面的代码将起作用,

With Sheets("MDCF Fund")
LR1 = Range("F" & Rows.count).end(xlup).row
Range("F80:F" & LR1).Select
Selection.clear
© www.soinside.com 2019 - 2024. All rights reserved.