+ Reply to Thread
Results 1 to 3 of 3

Using IF and INDIRECT in VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    Quebec, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Using IF and INDIRECT in VBA

    Hi,

    I'm looking to do an IF loop with INDIRECT. That way I can use only one loop for all my conditions. I want to do something like this:

    Range("CR22").FormulaR1C1 = "=MATCH(R[-3]C[2],INDIRECT(DriveN_RPM),FALSE)"
    DriveN_Row = Range("CR22")
    DriveN_Row_End = DriveN_Row + 25
    cible = 98
    
    For i = DriveN_Row To DriveN_Row_End
        If INDIRECT(CR23& i ) = Range("CT19") Then      'CR23 equals Sheet2!J (so the sheet and the column) and i would give me the row
            Cells(22, cible) = Sheets(INDIRECT(PAGE).Cells(i, "K").Value    
            cible = cible + 2
        End If
    Next i
    Thanks

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

    Re: Using IF and INDIRECT in VBA

    For the If perhaps.
        If Range(Range("CR23").Value & i) = Range("CT19") Then      'CR23 equals Sheet2!J (so the sheet and the column) and i would give me the row
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-11-2013
    Location
    Quebec, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using IF and INDIRECT in VBA

    Perfect!! Thanks!

+ 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. Sum of indirect sheet names with multiple cells (SUM, INDIRECT,SHEETNAME in cell)
    By a1b2c3d4e5f6g7h8 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-12-2013, 08:42 AM
  2. Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Andy Wiggins in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  4. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  5. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-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