ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Go all the way along a row and then delete... (https://www.excelbanter.com/excel-programming/371503-go-all-way-along-row-then-delete.html)

Darin Kramer

Go all the way along a row and then delete...
 


HI there,

I need Excel to go from c1 all the way to the end of the row (ie until
there is no more data in row 1), then go one more cell to the right (ie
now in a blank cell), then go down to the last bit of info in that
column, then delete from that point all along the row (ie going to the
right :), ie higher column refs ) until it runs out of data.

Thanks - appreciate some help - (Im struggling with where to put the
offsets....

Regards


D

*** Sent via Developersdex http://www.developersdex.com ***

Bob Phillips

Go all the way along a row and then delete...
 
Sub DeleteData()
Dim iCol As Long
Dim iRow As Long
Dim StartRow As Long

StartRow = 10 'adjust startrow to suit
iCol = Cells(StartRow, Columns.Count).End(xlToLeft).Column
iRow = Cells(Rows.Count, iCol).End(xlUp).Row
Range(Cells(iRow, iCol), Cells(iRow, iCol).End(xlToRight)).ClearContents
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Darin Kramer" wrote in message
...


HI there,

I need Excel to go from c1 all the way to the end of the row (ie until
there is no more data in row 1), then go one more cell to the right (ie
now in a blank cell), then go down to the last bit of info in that
column, then delete from that point all along the row (ie going to the
right :), ie higher column refs ) until it runs out of data.

Thanks - appreciate some help - (Im struggling with where to put the
offsets....

Regards


D

*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com