Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Delete row will not work

  Asked By: Lucas    Date: Jan 25    Category: MS Office    Views: 587
  

I'm trying to delete a row using VBA. I've tried both...

Selection.Delete Shift:=xlUp
&
Selection.EntireRow.Delete

Both work when I step through (F8) the code but neither will work when
the code is run live. The code processes without giving an error but
the row does not get deleted. Any ideas?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Adanalie Garcia     Answered On: Jan 25

There is nothing wrong with Selection.EntireRow.Delete

It must be a problem elsewhere in the code. Could you post more of it? You
could put a breakpoint on the line before and see what is happening.

 
Answer #2    Answered By: Ginger Snyder     Answered On: Jan 25

Sometimes you just need to go home and sleep on it. The problem was
with the calling proceedure. The call was in an If/Then statement.
Because of a mistake in that sub it was always executing the first
condition (adding/updating the info to the file) and never executing
the ELSE portion (deleting). Fixed that and now my routine works in
step through AND live  (duh).

 
Answer #3    Answered By: Jimmy Abp     Answered On: Jan 25

Rows(Activecell.Row).Delete Shift:=xlUp works for me hope it works as
well for you.

 
Didn't find what you were looking for? Find more on Delete row will not work Or get search suggestion and latest updates.




Tagged: