How to Delete a VBA code

rodroll

New Member
Joined
Jul 5, 2011
Messages
2
Hello,

I am not an basic excel user but I know nothing about VBA and macros, so my question may sound silly.
I was finishing a pivot table and wanted the table to refresh automatically, I searched the net for a solution and followed this suggestion:

"Right click the tab of the worksheet that contains your source data and pivot table and select View Code. This will present you with a code module which is associated with this particular sheet. Type this:

Private Sub Worksheet_Change(ByVal Target As Range)
Me.PivotTables(1).RefreshTable
End Sub

It assumes that there is only one pivot table on your worksheet."

I did that and did not like the result. So I wanted to delete this code.
And now it starts the problem.
I managed to succesfully delete the middle line, but the first and the third are still there.
In the microsoft visual basic, when "general" is select on the top of the window in the dropdown menu, there is no code, but when I select worksheet, I can see the code. And the code apeears in every worksheet of every file that I open.
Does anybody know why this is happening, and how I can delete these 2 lines of code?

Thanks In advance.

Rod
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi Rod,

You don't have to do anything. This is perfectly natural. When you select "worksheet" what you are seeing is the default option.

In the next drop down box are all the options that are available for each sheet, Activate, Calculate, etc etc...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top