PDA

View Full Version : Solved:Macro to delete selected by my rows, columns, cells



k0st4din
03-14-2013, 12:34 PM
Hello friends
I need very urgent help on something perhaps too simple for you, you know.
I am looking for a macro that does the following:
I make my button, it wrote a macro to do the following:
tagged cells selected by me, either to each other or in different places, with or without words in them can be deleted.

SamT
03-14-2013, 05:31 PM
I make my button, it wrote a macro to do the following:
tagged cells selected by me, either to each other or in different places, with or without words in them can be deleted.

Is it too late?

Anyway I don't understand what you mean.:dunno

Sorry.

k0st4din
03-14-2013, 10:42 PM
Hello, if no macro, but just a simple table and want to delete eg A1, D2, C2, Y15, hold down "ctrl" and then the button "delete" and delete everything that I have chosen. Therefore, I found very similar macros, but nobody wanted to work or make so-called unlimited selection of cells.
If there's anything else ask me.
On the button - I mean, I've done button to assing macro

SamT
03-15-2013, 01:01 AM
Select the cells you want to delete first, then press your button.
This procedure (Macro) will shift the column up under a deleted cell.
Sub DeleteManyCellsShiftUp()
Dim i As Long 'Used as counter
Dim CellsToDelete As Range

Set CellsToDelete = Selection 'The Cells you selected

'Counting backwards deletes from bottom up. Prevents
'deleting the wrong cell because it shifted.
For i = CellsToDelete.Count To 1 Step -1
CellsToDelete.Cells(i).Delete (xlShiftUp)
Next i
End Sub

k0st4din
03-15-2013, 01:29 AM
This is amazing, thank you very much. You are wonderful and so diligent, focused to help anyone in need.
Endless thanks.

SamT
03-15-2013, 08:24 PM
You're welcome. Now please use the Thread Tools to mark this solved.