another VBA question

southpaw163

New Member
Joined
Aug 28, 2006
Messages
4
I have macro set up to delete selected row right now being:
Sub deleteactiverow()
Application.ScreenUpdating = False
ActiveSheet.Unprotect
ActiveCell.EntireRow.delete
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

But I don't want it to delete the entire row, I only want it to delete columns A-M. Is there a way I can do this? I want it to somehow select columns A-M on the current row and just delete them. But since the number of the current row could change I don't know what code to put in there. Can anyone help me out here? So far everyone has answered all of my questions with ease so I'm hoping that keeps up!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hello southpaw163. (welcome to the board.)
Do you mean something like this?
Code:
Sub deleteactiverow()
ActiveSheet.Unprotect
Range(Cells(ActiveCell.Row, "A"), _
      Cells(ActiveCell.Row, "M")).Delete
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Or do you not want these cells to shift up when deleted?
(If you don't then just replace 'Delete' with 'ClearContents'.)
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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