Results 1 to 2 of 2

Thread: runtime error 1004 help

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    42

    runtime error 1004 help

    Hi Guru's..
    I am getting this runtime error

    Method 'Range' of object '_Global' failed

    Here is the code causing it:

    Public Sub AddChartSheet()
    Dim dataRange As Range
    CAUSING ERROR ---> Set dataRange = Range(avgRange.averageRange.Text)
    avgRange.Hide
    ....
    End Sub

    avgRange is the name of my UserForm, averageRange is the name of the RefEdit object. Concerning the scope of my variable, do I need to declare anything global?

    Thanks!!

  2. #2
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591

    Re: runtime error 1004 help

    Are you sure your RefEdit text is a valid range? The "_Global" doen't refer to declaration of variables. It is the default object when no object is defined. So if the text in your RefEdit does not repesent a valid worksheet or cell reference, you would get this error message. Bascially it means that the range in the RefEdit test is nowhere to be found within the Excel object. A blank RefEdit would return this error. Note that the RefEdit object can be manually changed and therefore does not always refer to a valid range.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width