ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Row (https://www.excelbanter.com/excel-programming/360203-delete-row.html)

JohnUK

Delete Row
 
Hi,
I am looking for a way to delete a row depending on a number in a range. For
example, if 124 was in the range, I would then want to delete row 124.
My Poor attempt:

Sub Macro22()
Row = Range("Row").Value
Rows(" & Row & ").Select
Selection.Delete
End Sub

Any help greatly appreciated
Regards
John


Chip Pearson

Delete Row
 
Try

Rows(Range("TheRow").Value).Delete

where TheRow is the name of the cell containing the row number to
delete.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"JohnUK" wrote in message
...
Hi,
I am looking for a way to delete a row depending on a number in
a range. For
example, if 124 was in the range, I would then want to delete
row 124.
My Poor attempt:

Sub Macro22()
Row = Range("Row").Value
Rows(" & Row & ").Select
Selection.Delete
End Sub

Any help greatly appreciated
Regards
John




news.microsoft.com[_11_]

Delete Row
 
Sub Macro22()
Dim iRow as long
iRow = Range("Row").Value
Rows(Row).Delete
End Sub

HTH
--
AP

"JohnUK" a écrit dans le message de news:
...
Hi,
I am looking for a way to delete a row depending on a number in a range.
For
example, if 124 was in the range, I would then want to delete row 124.
My Poor attempt:

Sub Macro22()
Row = Range("Row").Value
Rows(" & Row & ").Select
Selection.Delete
End Sub

Any help greatly appreciated
Regards
John




JohnUK

Delete Row
 
Superb - Worked a treat
Many thanks

"Chip Pearson" wrote:

Try

Rows(Range("TheRow").Value).Delete

where TheRow is the name of the cell containing the row number to
delete.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"JohnUK" wrote in message
...
Hi,
I am looking for a way to delete a row depending on a number in
a range. For
example, if 124 was in the range, I would then want to delete
row 124.
My Poor attempt:

Sub Macro22()
Row = Range("Row").Value
Rows(" & Row & ").Select
Selection.Delete
End Sub

Any help greatly appreciated
Regards
John






All times are GMT +1. The time now is 01:25 PM.

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