ExcelBanter

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

Rhonda[_3_]

Delete a row
 
Hi,

I was wondering if anyone could provide me with a
function for a command button that when clicked, will
prompt the user for the row number they want to delete
and then delete it for them. Or if this is not possible,
something similar would also be great!!

Thanks for your help!

Chip Pearson

Delete a row
 
Rhonda,

Use code like the following:

Dim RowNdx As Long
RowNdx = Application.InputBox(prompt:="Enter a row number",
Type:=1)
If RowNdx 0 And RowNdx <= Rows.Count Then
Rows(RowNdx).Delete
End If


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



"Rhonda" wrote in message
...
Hi,

I was wondering if anyone could provide me with a
function for a command button that when clicked, will
prompt the user for the row number they want to delete
and then delete it for them. Or if this is not possible,
something similar would also be great!!

Thanks for your help!




Rhonda[_3_]

Delete a row
 
Thank you very much!!! That's great!!


-----Original Message-----
Rhonda,

Use code like the following:

Dim RowNdx As Long
RowNdx = Application.InputBox(prompt:="Enter a row

number",
Type:=1)
If RowNdx 0 And RowNdx <= Rows.Count Then
Rows(RowNdx).Delete
End If


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



"Rhonda" wrote in

message
...
Hi,

I was wondering if anyone could provide me with a
function for a command button that when clicked, will
prompt the user for the row number they want to delete
and then delete it for them. Or if this is not

possible,
something similar would also be great!!

Thanks for your help!



.



All times are GMT +1. The time now is 10:26 PM.

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