+ Reply to Thread
Results 1 to 3 of 3

Refer to a dynamic workbook in formula

Hybrid View

  1. #1
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Refer to a dynamic workbook in formula

    Hi,

    I have been searching hi & low to solve this on my own. I am @ my whits end. I want to point @ a specific workBooks that I have open or am opening in the code.

    I am trying to do this as a VBA formula that I fill down a Column.

       
    '/////////////////////////////////////////////////////////////////////////////////////////////////////////
        Set Awbk = ActiveWorkbook   'This is the current workbook that we want to populate.
        Set CurPop = ActiveWorkbook.ActiveSheet     'This is the sheet we will be working with
    '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        If dLast > 0 Then
            Workbooks.Open strPrevFolder & Dir(strPrevFolder & "*.xlsb", vbNormal)       
    '/////////////////////////////////////////////////////////////////////////////////////////////////////////
            
        Set Swbk = ActiveWorkbook   'This is the workbook that we are drawing the data from.
        Set DrawDat = ActiveWorkbook.ActiveSheet        'This is the sheet we will be working with
        
        Set Twbk = ThisWorkbook     'This is the workbook that the code is being ran from.       
    '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    
       Awbk.Activate
       
        Range("A1").Select
        
        Range(Selection, Selection.End(xlToRight)).Select
        Selection.End(xlToRight).Select
    
        ActiveCell.Offset(0, 1).Range("A1").Select      
       
    'This works from the cell I want to run it from, but when I try to run it in VBA it gets hung-up.
        '=IFERROR(MATCH(C:C,'[test_DB 10-16-13 @ 2.06AM 17_seconds_.xlsb]test10-16-13 @2.06AM.17_sec'!$C:$C,0),"")
    
    'This is really what I wanted to do, because we come to this code through a loop & the workBooks & sheet names change each time.
        '=IFERROR(MATCH(C:C,'[Swbk]DrawDat'!$C:$C,0),"")
       
        Selection.FormulaR1C1 = "PDat"
            ActiveCell.Offset(1, 0).Range("A1").Select
        
                ActiveCell.FormulaR1C1 = "=IFERROR(MATCH(C:C,'[Swbk]DrawDat'!$C:$C,0),"""")"
    Any help offered is much appreciated.

    Thanks,

    dlow :D

  2. #2
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Refer to a dynamic workbook in formula

    The specific error I get is: Application-defined or object-defined error.

  3. #3
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Refer to a dynamic workbook in formula

    Tennis anyone?

    Still have this problem & hoping someone might be able to help me out. If I get it worked out I will post back results.

+ 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. [SOLVED] How to refer to the workbook where the macro when another workbook is open during runtime?
    By jonelamora in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 11:21 PM
  2. Refer to another open workbook when entering in a formula
    By NukedWhale in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2010, 06:47 PM
  3. Help with Dynamic Workbook within a formula.
    By Neil07979 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-27-2009, 08:01 AM
  4. Dynamic External Workbook Formula
    By Co-op Bank in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2005, 01:10 PM
  5. refer to dynamic range in closed workbook with ADO
    By MattShoreson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2005, 06:26 AM

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