+ Reply to Thread
Results 1 to 3 of 3

Problem with Range function!

  1. #1
    Registered User
    Join Date
    09-14-2014
    Location
    Michigan
    MS-Off Ver
    2007
    Posts
    1

    Problem with Range function!

    I have a small macro that I'm having trouble with. On the first pass I am activating sheet 3 in the workbook with the command "Sheet3.Activate"
    Following that I am looking for the min/max of a range of cells with the command, then storing the value into variable DataRMax.

    Range("F31:G72").Find(Application.WorksheetFunction.Max(Range("F31:G72"))).Activate
    DataRMax = ActiveCell.Value ' Finds Rising stage Max delay

    After many other functions I basically call up this subroutine again and activate the next sheet with a command - Sheet4.Activate
    I try to use the same range functions as above but it then stops the program and gives me an error

    "Run-Time error 1004 - Application-defined or object-defined error.

    As I run through the program everything works as expected, it activates sheet4, then tries to execute the range function. Do I need to to point to the active sheet in the range function somehow?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Problem with Range function!

    What is Application.WorksheetFunction.Max(...) returning?
    If posting code please use code tags, see here.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Problem with Range function!

    Hi,

    I know you've said you activate sheet 3 but have you tried fully qualifying the range with the sheet code name? i.e.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I seem to remember this tripping me up before.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with If function and min range.
    By tratto in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-20-2013, 08:14 AM
  2. function problem regarding cell range
    By chindo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-09-2005, 11:10 PM
  3. Problem with range in function
    By Jan Kronsell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2005, 06:05 PM
  4. [SOLVED] Problem adding a range using Sumif function.
    By Domenic in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Problem adding a range using Sumif function.
    By vrk1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1