Deleting a range of columns in a certain row

dallasp83

New Member
Joined
Mar 25, 2021
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am currently trying to delete columns B thru I in a particular row. I have tried many combinations by setting a range. The row will be the variable. I could only delete one or many based on a loop.
I can successfully delete a entire row which used to be useful. But I have since added data to the right of Row I That cannot be deleted.

Application.DisplayAlerts = False
For I = 5 To cell2
name = Sheet4.Range("D" & I).value

Set rgFound = Sheet1.Range("B5:B9999").Find(name)

'Delete columns B thru I on sheet1
myRow = rgFound.Row
Sheet1.Range("B" & myRow, "I" & myRow).Delete shift:=xlToUp

'delete the sheet
Sheets(name).Delete

Next I

Application.DisplayAlerts = True
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,467
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
How about
VBA Code:
Sheet1.Range("B" & myRow).resize( , 8).Delete shift:=xlToUp
 

Watch MrExcel Video

Forum statistics

Threads
1,129,362
Messages
5,635,818
Members
416,885
Latest member
hs11

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
Top