Delete visible range without deleting entirerow

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
13,475
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
I have the following code which filters column C and then I want to delete the visible range in columns A to E without deleting the entire row. Unfortunately, the code deletes the entire row which is problematic because i have data in columns to the right of column E which I want to keep. Any suggestions would be appreciated.
VBA Code:
Range("A3:F3").AutoFilter 3, "*Total*"
Range("A4" & ":E" & bottomC).SpecialCells(xlCellTypeVisible).Delete shift:=xlUp
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello Mumps,
I've got example and hopes that will be helpful.
VBA Code:
Sub DeleteShiftUp()
   
   Application.ScreenUpdating = False
   With ActiveSheet.Range("A1:F10")
      .AutoFilter 3, "*Total*"
      vA = ActiveSheet.Range("A2:F10").SpecialCells(xlVisible).Address
      .AutoFilter
      ActiveSheet.Range(vA).Delete Shift:=xlUp
   End With
   Application.ScreenUpdating = True
  
End Sub
 
Upvote 0
Solution
Thank you for your help. Much appreciated. :)
 
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top