Results 1 to 3 of 3

Method 'Range' of object _Global error (Error 1004)

Threaded View

  1. #1
    Registered User
    Join Date
    09-02-2019
    Location
    indi
    MS-Off Ver
    office 365
    Posts
    3

    Method 'Range' of object _Global error (Error 1004)

    
    Sub multi_guess_and_test()
    
    Dim ws_input As Worksheet
    Dim num_rows
    
    
    Set ws_input = ThisWorkbook.Worksheets("Input")
    num_rows = 5
    
    Dim i
    Dim j
    Dim k
    Dim l
    Dim set_cell_range As Range, to_value_range As Range, changing_cell_range As Range
    Dim to_value_val
    Dim temp_val
    Dim temp_range As Range
    
    For j = 2 To num_rows
        For i = 2 To num_rows 'i starts at 2 because we assume 1st row is label
        
            k = i + 7
            Set set_cell_range = Range(ws_input.Cells(k, j).Formula)
            
            On Error Resume Next
            l = i + 13
            Set to_value_range = Range(ws_input.Cells(l, j).Formula)
            If Err.Number <> 0 Then
                to_value_val = ws_input.Cells(l, j).Value 'find the value of cell. Even if the cell is a formula, it is ok! (Originally, goal Seek does not allow this cell to be a formula.)
            End If
            On Error GoTo 0
            
            Set changing_cell_range = Range(ws_input.Cells(i, j).Formula)
            
            'now that all the inputs are set, perform goal seek operation
            set_cell_range.GoalSeek _
            Goal:=to_value_val, _
            ChangingCell:=changing_cell_range
            
        Next 'onto the next calculation!
    Next
    End Sub
    i am trying to call values using a for loop and is giving an error please help me.

    thank in advance.
    Attached Files Attached Files
    Last edited by uppidon111; 09-02-2019 at 04:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Error '1004': Method 'Range' of object '_Global' failed
    By ndudley26 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-05-2018, 02:03 AM
  2. Run-time error '1004' Method 'Range' of object'_Global' failed
    By mbie451 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2014, 01:40 PM
  3. Run-time error '1004'. Method 'Range' of object '_Global' failed
    By mjj347 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2012, 11:09 AM
  4. Run-time-error 1004 -- Method 'Range' of object '_Global' failed
    By tilleyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2012, 10:55 PM
  5. MACRO, ERROR 1004, Method 'Range' of object '_Global' failed
    By ssbhardw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 03:49 PM
  6. 1004:runtime error method 'range' of object'_Global failed
    By trksbc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2009, 03:25 AM
  7. [SOLVED] Error 1004 Method 'Range' of object '_Global' failed
    By bjwade62 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2006, 11:00 AM

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