简体   繁体   中英

Delete cell in which address is in another cell using excel vba

I need to delete a cell using an excel macro where the address to that cell is text in another cell. I need the code to be very simple as I am almost a complete beginner.

simple enough?

Sub Whipe()
Dim RAddress As Range, RAdrCell As Range
Dim RWhipe As Range, RWhipeCell As Range

    Set RAddress = Range([A1], [F6]) ' range containing the addresses
    Set RWhipe = Range([A7], [F12])  ' range containing data to be whiped

    For Each RWhipeCell In RWhipe.Cells
        For Each RAdrCell In RAddress.Cells
            If RWhipeCell.Address(False, False) = RAdrCell Then
                RWhipeCell = ""
            End If
        Next RAdrCell
    Next RWhipeCell
End Sub

before 在此处输入图片说明

after 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM