Excel Macro Removal
July 10, 2009 11:58 AM   Subscribe

Excel 2003 says I have macros in one workbook. I want to delete them, but Excel won't let me. NeoOffice (for the Mac) also won't let me. When I look for them using the Macro Dialog box or the VB editor, I can't find them. Can I delete these macros, or do I have a serious problem?

This is only happening in one workbook, which I use frequently between Excel 2003 (WinXP SP3) and NeoOffice (Mac 10.5.x). I do not intentionally use macros and set the security to Very High, but I do not know if I accidentally created one. The Macro Dialog Box tells me I have nothing. The Visual Basic editor does not display any modules I would expect to have macros, so I have nothing to delete.

It seems each sheet does have the following:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

but my impression is that this is part of a standard library, since other spreadsheets that I use also have it. Yet the workbook in question is the only one that generates the "you have macros" message.

There are also no hidden sheets, as far as Excel is able to tell me.

The way I move from Mac to PC is by uploading my files from one machine via SSH to a unix account, then downloading them on the other. I know I could use a flash drive, but this is what I do, and I like having a copy of files on a separate machine monitored by a sys-admin.

Please help me figure out how to remove these hidden macros. I am not familiar enough with macros nor with VB. I hope this isn't a sign of something more serious (a virus/spyware scan reveals nothing), and I'd hate to have to write a completely new workbook with the same amount of data.
posted by CancerMan to Computers & Internet (6 answers total)
Response by poster: If I remove the subroutine and save, it reappears when I load the worksheet again.
posted by CancerMan at 12:36 PM on July 10, 2009

in the vb console try Sheets(1).visible =true and see what you get. Some 3rd party excel addins do this, as do some viruses, but that only one of your sheets reports this suggests it is probably not a virus.

Alternatively, create a new workbook, and copy each sheet to the new workbook, this should rid you of the problem for not too much work.
posted by fistynuts at 1:07 PM on July 10, 2009

Response by poster: I opened a new blank workbook (New -> blank workbook), saved it, quit Excel and opened the new file. No macro message.

Alt-F11 to open the VB Editor, and that sub is there, but I have to select "Worksheet" from the drop-down menu.

On a hunch, I quit Excel again, but this time I saved the file when prompted. Now when I open that file, I am given the macro warning message.

I think by simply going to the VB editor and looking at a sub, I've added or activated that macro.

If this is the case, is there a way to deactivate it, or am I stuck?
posted by CancerMan at 1:15 PM on July 10, 2009

Response by poster: @fistynuts: There appears to be no change if I add that line of code. And I am able to copy data into a new workbook, but I'd like to know what I could do if this happens again.

@odinsdream: On a new file, when I right-click and View Code, I see the "General" drop-down selection.

On the affected file, right-click + View Code shows me the "Worksheet: Selection Change" sub.
posted by CancerMan at 1:34 PM on July 10, 2009

Best answer: It has been a few days since you asked this but I'm not sure if you got your answer or not so here are my thoughts.

Go into VB remove the subroutine and save. Don't click on anything else, exit VB and this should fix it.

When you use the drop down box in VB and select Worksheet it automatically adds that subroutine. So whatever you do don't use that drop down. It is a little confusing because it looks like the drop down takes you to different areas but it doesn't, it just adds that subroutine. It's more like a shortcut.
posted by mrpeach at 12:31 PM on July 14, 2009

Response by poster: Ah, so it is adding the subroutine. Thanks for the tip!
posted by CancerMan at 10:08 AM on July 15, 2009

« Older Need help rendering Poe in Latin.   |   Where can I make money online? Newer »
This thread is closed to new comments.