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: 2
Default Defining a Range

Hi, i'm trying to define a range with variables so I can search down a page
and produce graphs till an empty cell is found so it stops the loop but i'm
getting a "run time error '1004': Application-defined or object-defined
error".

My code so far;

Sub Produce_Cum_Graph()
'
' Produce a cumulative graph
' Macro recorded 30/03/04 by Ric
'
'
' Select sheet from where data is to be used
Sheets("cum_data").Select

' define variables
Start = 2 ' Used for row 2
SRow = 1
SCloumn = 3
ERow = 5
EColumn = 39
t1 = Cells(Start, 1).Value ' Contract Name
t2 = Cells(Start, 2).Value ' Contract Number

With Worksheets("cum_data")
Set MyRange = Range(Cells(SRow, SColumn), Cells(ERow, EColumn))
' Slecet range
End With

TheTitle = t2 & " " & "-" & " " & t1 ' Adds Contract Number & space
& - & space & Contract name together
Fname = t2 ' This will be filename of Graph
Call cum_graph ("MyRange", TheTitle", "Fname")

End Sub

cum_graph is a recorded Macro of creating a graph.
MyRange is interposed instead of an actual cell reference in cum_graph.
TheTitle is interposed instead of the typed title while creating the graph.

The error appears at line "Set MyRange..."

Am I going about this in totaly the wrong way to generate a range?

Ric


 
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
Defining Range Name anshu[_2_] Excel Discussion (Misc queries) 2 July 22nd 07 07:30 AM
Defining a range Don Excel Worksheet Functions 1 February 25th 05 03:54 PM
Defining range Edgar[_3_] Excel Programming 2 February 17th 04 02:24 PM
Defining a range Matt Excel Programming 3 January 23rd 04 03:21 PM
Defining Range MAB[_5_] Excel Programming 2 September 15th 03 02:48 PM


All times are GMT +1. The time now is 08:12 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"