Results 1 to 2 of 2

Opening Excel files and using cell values in formulas

Threaded View

  1. #1
    Registered User
    Join Date
    05-31-2010
    Location
    Quebec, Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Opening Excel files and using cell values in formulas

    Hello,

    I'm creating an Excel file which lets the user choose if he wants the data with or without management override. The problem is that the data in the summary depend on 14 Excel files, so I have to open them all. So in the macro, I need to

    1. Open all the Excel files
    2. If Management Override is set to "W", set it to "W" in the 14 files. If it is set to "W/O", set it to "W/O".
    3. Put the good values in the cells with .Formula="..."

    I'm using something like this :

    Sub Bouton1_Clic()
        
        Application.ScreenUpdating = False
        Workbooks.Open Filename:=" .....
        
        If Range("E5") = "W" Then
            
            Workbooks("MTP 2009-2012 Ontario Broker.xlsm").Worksheets("UW Income").Range("C4").Value = "W"
    .....
            Range("C12").Formula = "='H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Broker.xlsm]UW income'!P13+'H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Commercial.xlsm]UW income'!Q13+'H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Novex.xlsm]UW income'!Q13"
            Range("C12:C18").FillDown
            Range("C22").Formula = "=(('H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Broker.xlsm]UW income'!P23*'H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Broker.xlsm]UW income'!P13)+('H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Commercial.xlsm]UW income'!Q23*'H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Commercial.xlsm]UW income'!Q13)+('H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Novex.xlsm]UW income'!Q23*'H:\Corporate\MTP\work\Ontario\[MTP 2009-2012 Ontario Novex.xlsm]UW income'!Q13))/C12"
            Range("C22:C28").FillDown
    etc.
    The problem is that it is very long to load (about 2 min for the entire macro). Is there a way to run it faster?

    Thanks
    Last edited by teylyn; 05-31-2010 at 05:12 PM.

Thread Information

Users Browsing this Thread

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

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