Delete / remove module NEW Question added :)

yoko

Active Member
Joined
Sep 5, 2006
Messages
349
Sorry really noob question I expect. How do i remove a module from the VB editor in Excel?

In the VBAProject box on the right at the bottom of the tree are 2 modules and I only want one but there is no delete function when you right click on it.

Cheers

:)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Why not just use Remove ModuleX...?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
By right clicking and going to Remove ModuleX...:)
 

yoko

Active Member
Joined
Sep 5, 2006
Messages
349

ADVERTISEMENT

ARGH!!!!!!!!!! :oops: :oops: :oops:

Thanks
 

yoko

Active Member
Joined
Sep 5, 2006
Messages
349
Seeing as I'm on a roll I'll ask another noob question.

Ive made a macro that makes 4 charts on the sheet, but to test it I've run it several times and every time a chart is made its being named Chart 1, Chart 2 and so on so now I'm up to chart 29 even though there are only 4 charts on the sheet :oops:

How do I get it to name the chart from 1, 2, 3 etc every time i run the macro no matter how many charts have been made before?
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251

ADVERTISEMENT

Check in the automatically created code. There will be a statement like Name:="Chart57". You can change that to somethign like "ColumnChart1" and charts created with the code should keep that name thereafter. BUT -- you need to delete the existing chart with the saem name before runnign the code again...

Denis
 

yoko

Active Member
Joined
Sep 5, 2006
Messages
349
The code I got for making a chart is...

Code:
    Sheets("January").Select
    Range("A4:C25").Select
    Charts.Add
    ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
        "Line - Column on 2 Axes"
    ActiveChart.SetSourceData Source:=Sheets("January").Range("A4:C25"), PlotBy _
        :=xlColumns
    ActiveChart.SeriesCollection(1).XValues = "=January!R6C1:R25C1"
    ActiveChart.Location Where:=xlLocationAsObject, Name:="January"
    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = "January Lables"
        .Axes(xlCategory, xlPrimary).HasTitle = False
        .Axes(xlValue, xlPrimary).HasTitle = False
        .Axes(xlCategory, xlSecondary).HasTitle = False
        .Axes(xlValue, xlSecondary).HasTitle = False
        
        End With

ActiveChart.Location Where:=xlLocationAsObject, Name:="January"


In bold is the chart name:- you mentioned but when a new chart is made it is still referred to as "chart x" with x incrementing every time a chart is made. So make a chart its called chart 1 delete it and make another and its chart 2 etc
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Hmmm -- sorry.

I was thinking of pivot tables, where you can name the pivot table. Normally if I am working with charts, I cycle through them:

Code:
For Each ChObj in ActiveSheet.ChartObjects
'...do stuff in here

Next ChObj
Denis
 

yoko

Active Member
Joined
Sep 5, 2006
Messages
349
Hmmm -- sorry.

I was thinking of pivot tables, where you can name the pivot table. Normally if I am working with charts, I cycle through them:

Code:
For Each ChObj in ActiveSheet.ChartObjects
'...do stuff in here

Next ChObj
Denis

I like that but what if I have 4 charts in one sheet, wont it move all 4 charts to the same position on the sheet?
 

Forum statistics

Threads
1,137,301
Messages
5,680,705
Members
419,929
Latest member
Atlas Quinn

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
Top