Delete a row

  • Thread starter Thread starter Rhonda
  • Start date Start date
R

Rhonda

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,

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
 
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






.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top