Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Worksheet_SelectionChange Event - How to Delete ? 4

Status
Not open for further replies.

DaleWatson123321

Programmer
Jun 12, 2001
1,788
CA
For some odd reason, the following code recently keeps "popping up" in all the worksheets I open.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

End Sub

I've double-checked my "Personal.xls" file, with no indication that it originates from there.

When I delete the code, or comment-it-out, the same code "re-appears" the next time I open the file - any file.

I expect (hope) this situation is "well known" to some of you VBA experts out there, and that you'll be able to HELP.
.....H E L P......H E L P.......

Needless to say, I will much appreciate a solution.

Thanks !!!

...Dale Watson dwatson@bsi.gov.mb.ca
 
Dale,

It sounds as if a macro is running on startup. Do you use macros? Click -Tools ->Macro ->Macros to see if you yave any macros. If there are any listed; click any you do not recognize, then click Edit to see what it does. You can also click Options and possibly tell Excell not to run that macro.

If it is not a macro, does this problem exist in a blank worksheet?

Post a reply here to let us know what how you make out!
 
jhimes,

Thanks for your response.

I've been using macros for a reasonable period (about 3 years).

It shows up in Sheet1 of Book1.xls. This is where I've tried deleting it, and tried commenting it out, but yet it still re-appears the next time I load Excel.

And it also shows up in old files - in Sheet1 - where previously this did NOT exist.

So it seems you're on the right track, with your comment that it appears to be happening (creating itself) "on start-up".

But that is as far as I've been able to take this.

I'm left wondering what specific area I need to look, so as to make the necessary change to "kill" this event.

I hope this provides enough additional info to help narrow the focus.

Thanks, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Dale,
Needless to say, this is strange. Sounds like a virus. Worksheet_SelectionChange is a Private sub that can only be executed by the Worksheet Selection Change Event for that worksheet object. Did this begin happening after you had opened a new file? I don't necessarily mean an Excel file, but anything you might have recieved in an eMail, a disk or downloaded.

Other than that, I have no ideas at all. :-( Skip,
metzgsk@voughtaircraft.com
 
Dale,

I have to agree with Skip on this one; and I can't think of anything else right now to help. Sorry!

Jim mistech@softdisk.com
 
Do you have a Book.xlt in a startup directory ?. If so it acts as the default template, and whatever is it then becomes part of all new workbooks. Check for such a file and open it and check for the code.

AC
 
It definitely sounds like a virus. But, on the rare occasion that it is not, check your "Personal.xls" book and see if your macros have been associated with ONLY that workbook and not for global sharing with others.

Sometimes, when I create a customized toolbar and associate a macro to a button, it will request and answer to the above paragraph. Sorry, I can't give specific instructions, I only have excel at work. Obviously, I'm not there right now, but I'll check into it and get back to you.

--MiggyD
It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
 
What a way to get attention !!!!

It turns out the "problem" was "self-inflicted", and was NOT a virus.

Even though the solution was not related to any of your comments and suggestions, I want to THANK ALL of you for your input, and thus the "STARS".

Here's what happened...

Somehow I had accidentally removed one of my custom toolbar icons - the one I've been using to access the &quot;Macro&quot; window - same as hitting <Alt> <F8>. I had edited the icon to make it &quot;text only&quot; and used &quot;&Q&quot; to allow me to activate it by using <Alt> Q - a &quot;one-handed&quot; effort instead of the &quot;two hands&quot; required in using <Alt> <F8). As you can see, I've &quot;gone overboard&quot; on my &quot;keyboard efficiency&quot;. Incidentally, the “proper” icon to use is… Customize – Commands – Tools – Macros, which I’ve NOW re-created.

When I went to replace this icon, I inadvertently chose the &quot;View Code&quot; icon from the &quot;Control Toolbox&quot;. It appears that using the &quot;View Code&quot; icon ALWAYS produces the &quot;Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)&quot; event in Sheet1 of any Workbook which is opened.

I don't happen to know the purpose of this &quot;feature&quot;.

Perhaps one of you can &quot;shed some light&quot; on this ? ? ?

Thanks again for your help !!!

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Dale,

It's about time...

that you got some time off for...

R & R

... rest and....
Re-Creation

LOL


Skip,
metzgsk@voughtaircraft.com
 
Bravo!!
(but please, NO encore LOL)

Glad we could help to focus your search and repair mission. ;-) --MiggyD

It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top