LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro problems with range and naming issues

Is it possible where i can create a macro that automates graphs. Th
problems that i am having is that:

1) The workbook name ( i don't want it to work just for that workbook
but the macro sets the work book name)

2) The range of the data that I can use (again the macro sets th
data... I tried to use another code to modify this but i am having n
success).

Option Explicit

Sub SelectingRange()
Dim lngRow As Long
Dim myTotalRow As Long
Dim lngCol As Long
Dim myTotalCol As Long

' counting rows
lngRow = 2
Do While Cells(lngRow, 1) < ""
lngRow = lngRow + 1
Loop
myTotalRow = lngRow - 1

' counting columns
lngCol = 2
Do While Cells(1, lngCol) < ""
lngCol = lngCol + 1
Loop
myTotalCol = lngCol - 1
ActiveSheet.Range(Cells(1, 1), Cells(myTotalRow, myTotalCol)).Select

End Sub

' This is the code to select the new range, but i believe that i nee
to make it return the values so i can insert it in the macro, or mayb
if i can call on it to achieve the range, but i do not know how to d
this.


here's the main code

Sub anmSum()
'
' anmSum Macro
'

'
Application.Run "personal.xls!SelectingRange"
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceDat
Source:=Sheets("announcement052704").Range("A1:Q63 ") _
, PlotBy:=xlColumns
' *** I need to change the sheet b/c the name will not be the same..
Also, the range should not be the same. ***
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:= _
"Announcement Graph"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Announcement"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Tim
(min)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Count"
End With
With ActiveChart
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True
End With
ActiveChart.Axes(xlCategory, xlPrimary).CategoryType
xlCategoryScale
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
End Sub

if anyone knows how to solve this solution it would be great than
you.

tia

--
Message posted from http://www.ExcelForum.com

 
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
Range naming Squeaky Excel Discussion (Misc queries) 2 December 29th 06 09:10 PM
Naming a range during macro execution Kevryl Excel Discussion (Misc queries) 2 December 11th 06 10:08 AM
Macro Range issues (I think) tmann New Users to Excel 3 November 24th 05 08:23 PM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM
Naming a range with VBA... Steff_DK[_14_] Excel Programming 5 April 27th 04 03:55 PM


All times are GMT +1. The time now is 08:33 AM.

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"