Deleting a row in a spreadsheet using row number
I need the code for a userform where I have a text box I put a row number in and a delete button to delete the row in the text box.  I don't need it to copy the data and move it all I want it to do is to delete it.  I can't figure it out, if someone has a solution I would appreciate it.

  • Edited by RussellDVW Thursday, April 09, 2015 4:59 PM
April 9th, 2015 4:50pm

Re:  "...now is there any way to..."

I see "mission creep" ocurring here.
Your request can get complicated...
  What if the user enters "1,3;xyz,9 44" ?
  You can prevent entries into a textbox, that are not numbers or commas, using the Textbox_KeyPress event.
  You can also clean up the text after entry by removing all non-numbers and dupe commas.
  Then the Split function can be used to separate the entry into row numbers.
  Verification by the user (with a message box) at this point would be wise.
  Each row could then be verified to contain data using Application.WorksheetFunction.CountA.

Suggest you review the VBA help file for: KeyPress event, Like operator, Split function, Msgbox function and the Excel CountA function; then post a new question.

'---
Jim Cone
  • Edited by James Cone Thursday, April 09, 2015 10:30 PM
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2015 10:29pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics