Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Position of X-Axis (Top, Left)

Hello,
I would to do the following in a Excel Macro:
I want to move a Button to right above the X-Axis of my chart.
This ist my code so far. No matter what I try, the button never
appears directly above the axis, but some inches higher.
What is my mistake?


ActiveSheet.ChartObjects("Diagramm").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
'Achse
achselinks = Selection.Left
achseoben = Selection.Top


'Plot
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.PlotArea.Select
plotlinks = Selection.Left
plotoben = Selection.Top


'Chartobject
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.ChartArea.Select
chartlinks = Selection.Left
chartoben = Selection.Top


'Hier wird der Button verschoeben
ActiveSheet.Shapes("Button").Select
ActiveSheet.Shapes("Button").Top = plotoben + achseoben +
chartoben
ActiveSheet.Shapes("Button").Left = achselinks + chartlinks

Thanks a lot!
Johannes

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Position of X-Axis (Top, Left)

What kind of chart? If it's a horizontal bar chart, the X axis is the
vertical axis on the left side of the chart.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


wrote in message
oups.com...
Hello,
I would to do the following in a Excel Macro:
I want to move a Button to right above the X-Axis of my chart.
This ist my code so far. No matter what I try, the button never
appears directly above the axis, but some inches higher.
What is my mistake?


ActiveSheet.ChartObjects("Diagramm").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
'Achse
achselinks = Selection.Left
achseoben = Selection.Top


'Plot
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.PlotArea.Select
plotlinks = Selection.Left
plotoben = Selection.Top


'Chartobject
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.ChartArea.Select
chartlinks = Selection.Left
chartoben = Selection.Top


'Hier wird der Button verschoeben
ActiveSheet.Shapes("Button").Select
ActiveSheet.Shapes("Button").Top = plotoben + achseoben +
chartoben
ActiveSheet.Shapes("Button").Left = achselinks + chartlinks

Thanks a lot!
Johannes



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Position of X-Axis (Top, Left)

Try it this way:

With ActiveSheet.ChartObjects("Diagramm")
achselinks = .Chart.Axes(xlCategory).Left
achseoben = .Chart.Axes(xlCategory).Top

chartlinks = .Left + .Chart.ChartArea.Left
chartoben = .Top + .Chart.ChartArea.Top
End With

With ActiveSheet.Shapes("Button")
.Top = chartoben + achseoben - .Height
.Left = chartlinks + achselinks
.ZOrder msoBringToFront
End With


--
Hope that helps.

Vergel Adriano


" wrote:

Hello,
I would to do the following in a Excel Macro:
I want to move a Button to right above the X-Axis of my chart.
This ist my code so far. No matter what I try, the button never
appears directly above the axis, but some inches higher.
What is my mistake?


ActiveSheet.ChartObjects("Diagramm").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
'Achse
achselinks = Selection.Left
achseoben = Selection.Top


'Plot
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.PlotArea.Select
plotlinks = Selection.Left
plotoben = Selection.Top


'Chartobject
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.ChartArea.Select
chartlinks = Selection.Left
chartoben = Selection.Top


'Hier wird der Button verschoeben
ActiveSheet.Shapes("Button").Select
ActiveSheet.Shapes("Button").Top = plotoben + achseoben +
chartoben
ActiveSheet.Shapes("Button").Left = achselinks + chartlinks

Thanks a lot!
Johannes


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Position of X-Axis (Top, Left)

Hello Vergel Adriano,
thanks a lot for your answer!

Why does your solution only work, when my Zoom is 100% ?



Johannes

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Position of X-Axis (Top, Left)

It is avertikal bar chart.

On 5 Sep., 14:40, "Jon Peltier"
wrote:
What kind of chart? If it's a horizontal bar chart, the X axis is the
vertical axis on the left side of the chart.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

wrote in message

oups.com...



Hello,
I would to do the following in a Excel Macro:
I want to move a Button to right above the X-Axis of my chart.
This ist my code so far. No matter what I try, the button never
appears directly above the axis, but some inches higher.
What is my mistake?


ActiveSheet.ChartObjects("Diagramm").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlCategory).Select
'Achse
achselinks = Selection.Left
achseoben = Selection.Top


'Plot
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.PlotArea.Select
plotlinks = Selection.Left
plotoben = Selection.Top


'Chartobject
ActiveSheet.ChartObjects("Diagramm").Select
ActiveChart.ChartArea.Select



chartlinks = Selection.Left
chartoben = Selection.Top


'Hier wird der Button verschoeben
ActiveSheet.Shapes("Button").Select
ActiveSheet.Shapes("Button").Top = plotoben + achseoben +
chartoben
ActiveSheet.Shapes("Button").Left = achselinks + chartlinks


Thanks a lot!
Johannes- Zitierten Text ausblenden -


- Zitierten Text anzeigen -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Position of X-Axis (Top, Left)

Hi Johannes,

I tested it and it does seem to work only at 100% zoom. It works on other
zoom levels but not consistently.. perhaps you can temporarily set the zoom
level to 100%, move the button, then put it back on the starting zoom level...

Dim dblZoom As Double
dblZoom = ActiveWindow.Zoom
ActiveWindow.Zoom = 100

'paste here the code to move the button

ActiveWindow.Zoom = dblZoom




--
Hope that helps.

Vergel Adriano


" wrote:

Hello Vergel Adriano,
thanks a lot for your answer!

Why does your solution only work, when my Zoom is 100% ?



Johannes


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Position of X-Axis (Top, Left)

A fair number of things in Excel don't work as expected if the zoom is not
100%. Charts seem to suffer particularly from this.

For fun, create a chart on a worksheet, change the zoom to 50%, copy the
chart, and paste it nearby. It's half the size of the original. This happens
at zooms < 100%, with the pasted chart being approximately the size of the
original times the zoom. Zooms 100% don't affect pasted chart size.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Vergel Adriano" wrote in message
...
Hi Johannes,

I tested it and it does seem to work only at 100% zoom. It works on other
zoom levels but not consistently.. perhaps you can temporarily set the
zoom
level to 100%, move the button, then put it back on the starting zoom
level...

Dim dblZoom As Double
dblZoom = ActiveWindow.Zoom
ActiveWindow.Zoom = 100

'paste here the code to move the button

ActiveWindow.Zoom = dblZoom




--
Hope that helps.

Vergel Adriano


" wrote:

Hello Vergel Adriano,
thanks a lot for your answer!

Why does your solution only work, when my Zoom is 100% ?



Johannes




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Position of X-Axis (Top, Left)

That´s strange.
Thanks again for your answer.
Usenet is always a good place for problems!

On 6 Sep., 23:26, Vergel Adriano
wrote:
Hi Johannes,

I tested it and it does seem to work only at 100% zoom. It works on other
zoom levels but not consistently.. perhaps you can temporarily set the zoom
level to 100%, move the button, then put it back on the starting zoom level...

Dim dblZoom As Double
dblZoom = ActiveWindow.Zoom
ActiveWindow.Zoom = 100

'paste here the code to move the button

ActiveWindow.Zoom = dblZoom

--
Hope that helps.

Vergel Adriano



" wrote:
Hello Vergel Adriano,
thanks a lot for your answer!


Why does your solution only work, when my Zoom is 100% ?


Johannes- Zitierten Text ausblenden -


- Zitierten Text anzeigen -



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
change sheet position right to left Aicha Excel Discussion (Misc queries) 4 July 22nd 07 10:04 AM
Position A2 at top-left of window hmm Excel Programming 2 November 20th 06 12:55 PM
Select worksheet tab at furthest left position joeski Excel Programming 3 August 28th 06 11:19 PM
Text Box 'Left' position problems... Trevor Williams Excel Programming 1 November 4th 04 06:12 PM
Move Cell to Top/Left Position on Screen Phil Hageman[_3_] Excel Programming 4 January 10th 04 07:24 PM


All times are GMT +1. The time now is 07:28 PM.

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

About Us

"It's about Microsoft Excel"