Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
lee lee is offline
external usenet poster
 
Posts: 184
Default Missing code in macro

I recorded a macro but when I go into the editor a lot of the code is
missing. All I see are objects that are activated or selected (see below).
I am using Excel 2007 on WindowsXP. Does anyone know what is going on? I
never had this problem with Excel 2003.
Thanks in advance,
Lee

Sub Macro2()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Missing code in macro

You probably already know that there are some things that the recorder will
not record. It basically records cell/range selections and keystrokes.

"Lee" wrote:

I recorded a macro but when I go into the editor a lot of the code is
missing. All I see are objects that are activated or selected (see below).
I am using Excel 2007 on WindowsXP. Does anyone know what is going on? I
never had this problem with Excel 2003.
Thanks in advance,
Lee

Sub Macro2()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Missing code in macro

I just recorded this with 2003 to test.

Sub Macro6()
'
' Macro6 Macro
' Macro recorded 12/16/2008 by Donald B. Guillett
'

'
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "mytitlehere"
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlLeft
ActiveWindow.Visible = False
Windows("20081201.xls").Activate
Range("U26").Select
End Sub

I then went to 2007 and recorded this. As you can see, I also had problems
but it seems to work. I haven't worked much with charts in 2007. I'm sure it
can be cleaned up without selections.

Sub Macro7() '2007 recordes

ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartTitle.Select

ActiveChart.ChartTitle.Text = "xxxNewtitlehere"
ActiveSheet.ChartObjects("Chart 2").Activate

ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.Legend.LegendEntries(1).Select
ActiveSheet.ChartObjects("Chart 2").Activate

Range("S18").Select
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 2").Activate
Selection.Top = 95.1
Selection.Height = 33.354
ActiveSheet.ChartObjects("Chart 2").Activate
Selection.Left = 15.058
Selection.Top = 92.1
Range("V15").Select
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lee" wrote in message
...
I recorded a macro but when I go into the editor a lot of the code is
missing. All I see are objects that are activated or selected (see
below).
I am using Excel 2007 on WindowsXP. Does anyone know what is going on? I
never had this problem with Excel 2003.
Thanks in advance,
Lee

Sub Macro2()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - Code Missing Shane Excel Discussion (Misc queries) 4 August 4th 09 08:53 AM
What is missing from this form code? Leanne Excel Programming 5 April 18th 08 07:59 PM
Missing code Steven Excel Programming 2 December 2nd 06 09:25 PM
Missing something in my code... Turquoise_dax[_14_] Excel Programming 3 June 23rd 06 05:57 PM
VB code gone missing Ian[_17_] Excel Programming 0 November 26th 05 11:57 AM


All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"