Selecting Cells in column for Deletion

Rocky0201

Active Member
Joined
Aug 20, 2009
Messages
278
Hi,

I am trying to select a number of cells in a column that may not be sequential in order to delete these cells and move cells up 1. My goal would be much like the following manual example:

Click on cell G4
Hold Ctrl key
Click on cell G6
Right click
Select delete
Select Shift Cells Up

I ran through a loop that built an array of the row number of the cells that I wish to delete but I'm lost on how to seclect just those cells in the array to perform the delete and shift cells up.

This is my code to indentify the rows of the cells in column G to delete"

Erase CheckBoxDelArray()
ReDim CheckBoxDelArray(1 To 14)

i = 1
ii = 4

For i = 1 To 14

If Me.Controls("CheckBox" & i).Value = True Then

CheckBoxDelArray(ii) = CheckBoxDelArray(ii) + 1

End If

ii = ii + 1

Next i

Using Watch, I determined the correct row numbers were in the array.

Any help would be great.

Thanks.
 
So your code reads:

Code:
s = Left(r, Len(r) - 1)
Debug.Print s
Range(s).Delete xlShiftUp

Mind the s after Debug.Print

Wigi
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Ah.. I did not include the s. Once I included the s, I received:

,,G7,,,,

in the Immediate Window (ctrl G). G7 is the cell I wish to delete and shift cells up 1.

Should I select the sheet before I do the Range(s).Delete xlShiftUp statement?
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,507
Members
449,236
Latest member
Afua

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