Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
I have recorded a macro to plot a chart of the data on a worksheet. I have a single book with about 100 worksheets each containing two columns of data that I would like to plot out. I plan to do it one at a time unless someone can show me the code needed to automate the process. My problem is that the macro contains a link to the first sheet (where I recorded the macro) and so even if I go to a different worksheet and then run the macro it plots the chart of the first sheet again, and places it on the first sheet. In the code below, how do I change the sheet name "20305A.TXT" in both the source data and location lines to something like 'this worksheet' or 'currently active sheet': Sub Macro4() ' ' Macro4 Macro ' Macro recorded 23/02/2007 by Dan ' ' Keyboard Shortcut: Ctrl+f ' Columns("A:B").Select Charts.Add ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveChart.SetSourceData Source:=Sheets("20305A.TXT").Range("A1:B501"), _ PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="20305A.TXT" With ActiveChart.Axes(xlCategory) .HasMajorGridlines = False .HasMinorGridlines = False End With With ActiveChart.Axes(xlValue) .HasMajorGridlines = True .HasMinorGridlines = False End With ActiveWindow.Visible = False Windows("Master data.xls").Activate End Sub Thanks, Dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
E-mailing the active worksheet | Excel Worksheet Functions | |||
name an active worksheet | Excel Worksheet Functions | |||
How to Add Rows From Active Cell with in a XLL Code | Excel Worksheet Functions | |||
how can I get the name of the active worksheet? | Excel Worksheet Functions | |||
email active worksheet | Excel Discussion (Misc queries) |