PC Review


Reply
Thread Tools Rate Thread

Buttons not always moving deleting rows. Odd behavior

 
 
Frank
Guest
Posts: n/a
 
      24th Jan 2012
Here is a problem I can’t seem to resolve.

I have an execution button on a sheet (sheet01) to clear my workbook.

On sheet03, I have rows to be deleted. On one row, there are “up-down”
sort buttons which needs to move up.

Here is the code

Sub button_delete_all()
If Range("pv_copy1").Offset(1, 0) <> "" Then
Range("reporting1").EntireRow.Delete
If Range("pv_copy2").Offset(1, 0) <> "" Then
Range("reporting2").EntireRow.Delete
End Sub

Pretty straight forward, right?

When I open my workbook and directly run the macro, the “up-down” sort
buttons on sheet03 do not move with the deleted rows. But (here is the
kicker), if I select sheet03 and go back to run the macro, the “up-
down” sort buttons move as expected.

I am puzzled and wanted to run it by experts (I am not a programmer by
trade).

I’ve uploaded my test spreadsheet at http://home.comcast.net/~gegene/test..xlsm

I am using Excel 2010 and Windows 7.
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      25th Jan 2012
I looked at your file and you may want to take a lok in the name
manager.


On Jan 24, 2:04*pm, Frank <no.rep...@comcast.net> wrote:
> Here is a problem I can’t seem to resolve.
>
> I have an execution button on a sheet (sheet01) to clear my workbook.
>
> On sheet03, I have rows to be deleted. On one row, there are “up-down”
> sort buttons which needs to move up.
>
> Here is the code
>
> Sub button_delete_all()
> If Range("pv_copy1").Offset(1, 0) <> "" Then
> Range("reporting1").EntireRow.Delete
> If Range("pv_copy2").Offset(1, 0) <> "" Then
> Range("reporting2").EntireRow.Delete
> End Sub
>
> Pretty straight forward, right?
>
> When I open my workbook and directly run the macro, the “up-down” sort
> buttons on sheet03 do not move with the deleted rows. But (here is the
> kicker), if I select sheet03 and go back to run the macro, the “up-
> down” sort buttons move as expected.
>
> I am puzzled and wanted to run it by experts (I am not a programmer by
> trade).
>
> I’ve uploaded my test spreadsheet athttp://home.comcast.net/~gegene/test.xlsm
>
> I am using Excel 2010 and Windows 7.


 
Reply With Quote
 
Frank
Guest
Posts: n/a
 
      25th Jan 2012
Hi Don:

That's not it either.

Here is what I found out:

It will work if you add the following:

Application.ScreenUpdating = True
Sheet03.Select
Sheet01.Select

But if you change to ScreenUpdating = False, it does not work.

I don't understand why sheet03 needs to be physically selected (and
shown as such) for these rows to properly delete.
 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      25th Jan 2012
On Jan 25, 9:58*am, Frank <san.francisco.scrab...@gmail.com> wrote:
> Hi Don:
>
> That's not it either.
>
> Here is what I found out:
>
> It will work if you add the following:
>
> Application.ScreenUpdating = True
> Sheet03.Select
> Sheet01.Select
>
> But if you change to ScreenUpdating = False, it does not work.
>
> I don't understand why sheet03 needs to be physically selected (and
> shown as such) for these rows to properly delete.


I repeat. You don't have a named range you are using...
 
Reply With Quote
 
Frank
Guest
Posts: n/a
 
      27th Jan 2012
Hi Don:

Thanks for the reply.

The named range was there but it was hidden.

I've uploaded the spreadsheet with unhidden named ranges.

Of course, the names disappear after the macro goes through.

But essentially the problem remains: Sheet03 must be "physically"
selected otherwise the "sort button" won't move with the deleted rows.

It's just bizarre.

Regards.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


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