MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 24th, 2002, 10:52 AM   #1
tealeaf
Board Regular
 
Join Date: May 2002
Location: mtl, canada
Posts: 160
Default

how do i select every graph in every sheet of the workbook?
ie i want code that resembles:

For everysheet in workbook
For everygraph in sheet
call myfunction()


tealeaf is offline   Reply With Quote
Old May 24th, 2002, 11:54 AM   #2
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-24 09:52, tealeaf wrote:
how do i select every graph in every sheet of the workbook?
ie i want code that resembles:

For everysheet in workbook
For everygraph in sheet
call myfunction()


Try somthing like:


Sub SelectCharts()
Dim Sht As Worksheet
Dim Chrt As Chart

'// Neede for Chart Sheet
On Error Resume Next
For Each Sht In ActiveWorkbook.Sheets
If Err Then
ActiveWorkbook.Charts.Select
Else
Sht.Select
End If
For Each Chrt In Sht.ChartObjects
Chrt.Select
'Do your thing
'Do it well
Next
Next
End Sub


_________________
Kind Regards,
Ivan F Moala From the City of Sails


[ This Message was edited by: Ivan F Moala on 2002-05-24 21:30 ]
Ivan F Moala is offline   Reply With Quote
Old May 24th, 2002, 12:12 PM   #3
tealeaf
Board Regular
 
Join Date: May 2002
Location: mtl, canada
Posts: 160
Default

Quote:
For Each Chrt In Sht.ChartObjects
gave me an error at that line,
i suppose i could play with it til i get something. thanks
tealeaf is offline   Reply With Quote
Old May 27th, 2002, 09:04 AM   #4
tealeaf
Board Regular
 
Join Date: May 2002
Location: mtl, canada
Posts: 160
Default

what i would like to do is select all the graphs of my workbook and then adjust all the axes of each graph to a given scale. in other words, each graph will be scaled to a 24h period starting at a given date and ending 24 hours later. i have managed to select all the graphs (i think) now i'd like to be able to do the updating.
tealeaf is offline   Reply With Quote
Old May 27th, 2002, 11:01 AM   #5
tealeaf
Board Regular
 
Join Date: May 2002
Location: mtl, canada
Posts: 160
Default

so far i have this for code:
Dim datedoub1, datedoub2 As Double

Sheets("table2").Select
Range("C1").Value = "2002-05-09 8:30"
Range("C2").Value = "2002-05-10 7:30"

Range("C1").Select
Selection.NumberFormat = "General"
Range("C2").Select
Selection.NumberFormat = "General"
datedoub1 = Range("C1").Value
datedoub2 = Range("C2").Value
[d1] = datedoub1
[d2] = datedoub2

Dim ofmysheet As Worksheet
Dim ofmygraph As Chart

On Error Resume Next
For Each ofmysheet In ActiveWorkbook.Sheets
If Err Then ActiveWorkbook.Charts.Select
ofmysheet.Select
For Each ofmygraph In ofmysheet.ChartObjects
ofmygraph.Select
ActiveChart.ChartArea.Select
Call okay((datedoub1), (datedoub2))
Next ofmygraph
Next ofmysheet

the function okay() is supposed to update the axes of the graph. as so:

Sub okay(mydatedoub1 As Double, mydatedoub2 As Double)
With ActiveChart.Axes(xlCategory)
.MinimumScale = mydatedoub1
.MaximumScale = mydatedoub2
.MinorUnit = 0.04
.MajorUnit = 0.08333333333333
.Crosses = xlCustom
.CrossesAt = mydatedoub1
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With

if i send okay() just one chart, it seems to work. it's when i try the For Loops i don't think i'm sending properly selecting the charts. help?
tealeaf is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes