VBA to delete row which has a merged cell

GlennL

New Member
Joined
Sep 25, 2018
Messages
33
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hellom

I have a cell which is merged from from C10 to H20.

I can select row 12, right button and delete the entire row and the entire row is deleted.

If I record the process, I get

VBA Code:
Sub Macro3()
'
' Macro3 Macro
'

'
    Rows("12:12").Select
    Selection.Delete Shift:=xlUp
End Sub

When I run the code above rows 10 to 20 are selected and deleted.

How can I get the one row to be deleted using VBA?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
This may work too.
VBA Code:
Sub deleteRow()

ActiveSheet.Rows(Selection.Row).Delete

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,402
Messages
6,119,301
Members
448,885
Latest member
LokiSonic

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