Programing VB in excel
Closed
wael
-
Jun 17, 2009 at 06:50 AM
venkat1926
venkat1926
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Related:
- Programing VB in excel
- Macro or VB in Excel 2007 ✓ - Forum - Excel
- Excel 2010/VB- Loop until no result is found - How-To - Download software
- Disable a cell in excel using VB code ✓ - Forum - Excel
- VBA code to open non excel programs ✓ - Forum - Excel
- VB Excel 2010 - Loop until can't find ✓ - Forum - Excel
1 reply
venkat1926
Jun 17, 2009 at 08:29 PM
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Jun 17, 2009 at 08:29 PM
do you want the two charts as different charts in the same sheet.
suppose the data is in C1 down in sheet1
and in D1 down in sheet2
in that run this macro. if the data are in different columns modify the macro suitably
give feedback
the macro is .
Sub test()
Dim rng As Range
On Error Resume Next
ActiveSheet.ChartObjects("mychart").Delete
suppose the data is in C1 down in sheet1
and in D1 down in sheet2
in that run this macro. if the data are in different columns modify the macro suitably
give feedback
the macro is .
Sub test()
Dim rng As Range
On Error Resume Next
ActiveSheet.ChartObjects("mychart").Delete
Charts.Add ActiveChart.ChartType = xlLineMarkers ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C1:C6"), PlotBy:= _ xlColumns ActiveChart.Location where:=xlLocationAsObject, Name:="sheet1" ActiveChart.Parent.Name = "mychart" Worksheets("sheet2").Activate Set rng = Range(Range("d1"), Range("d1").End(xlDown)) rng.Copy Worksheets("sheet1").Activate ActiveSheet.ChartObjects("mychart").Select ActiveChart.SeriesCollection.Paste NewSeries:=True End Sub