Select Multiple individual cells with variable column

macfam929

New Member
Joined
Jul 28, 2010
Messages
13
This has been one of the most frustrating coding days ever!! TIA for all of your help!

I want to select multiple individual cells to delete. If I am calling them out then
Code:
Range("F5, F7, F9, ....").Select 
Selection.Delete Shift:=xlUp
works. however I want to replace F with "LastCol + 1" where LastCol is:
Code:
LastCol = Cells.Find(What:="*", _
    SearchDirection:=xlPrevious, _
    SearchOrder:=xlByColumns).Column
I have tried:
Code:
Range(Cells(5, LastCol + 1), Cells(7, LastCol + 1)).Select
However that select row 6 as well, and if I try to add a 3rd argument to that it errors out.

Thanks for all of your help.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try

Code:
Union(Cells(5, LastCol + 1), Cells(7, LastCol + 1)).Delete Shift:=xlShiftUp
 
Upvote 0
Thank you!! That works great! You have been my saving grace today and kept me from wanting to bash my head into a wall!!!
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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