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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi & welcome to MrExcel.
How about
VBA Code:
Sheet1.Range("B" & myRow).resize( , 8).Delete shift:=xlToUp
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,255
Members
449,075
Latest member
staticfluids

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