Results 1 to 5 of 5

Thread: [RESOLVED] Updatelinks Only in One Worksheet

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    27

    Resolved [RESOLVED] Updatelinks Only in One Worksheet

    Is there any way that I can update all of the links in one worksheet, while leaving the rest of the links in the other worksheets in my workbook alone? I have one worksheet with links that need to be updated regularly, and links in pivotcharts in several other worksheets that take FOREVER to update and don't need to be updated. All of the sheets need to stay in one workbook, so I can't split them into multiple excel files. As far as I can tell, .updatelinks only works with ActiveWorkbook, as in the following code (which is what I'm running right now):

    Code:
    ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
    Any ideas?

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Updatelinks Only in One Worksheet

    .updatelinks only works with ActiveWorkbook
    Yes that is the way Excel works....

    In fact you got me thinking on how to achieve it... and to be honest I didn't have an answer... probably because there is no way "directly" to achieve what you want or probably I am not aware of one...

    However, but there is one DIRTY way to get what you want... (I just thought of it )

    1) Create a copy of your main workbook(Say Main.XLS) and save it as say Mainbkup.xls
    2) Delete all worksheets except the one that you want to update in Mainbkup.xls
    3) In this workbook, write a macro which will open you main workbook(Main.XLS) and
    a) Delete the sheet that you want to update!!!!!!
    b) Copy the worksheet from Mainbkup.xls to your main workbook after updating the links.

    Hope this helps...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    27

    Re: Updatelinks Only in One Worksheet

    Hey Koosid,

    Thanks for the dirty workaround. As it turns out, when I tried that, it worked great, but it wasn't because of the LINKS in the other worksheets, it was actually because of the calculations the corresponded to pivot charts that I had made based on those links. When I updated the links in my workbook, all of the calculations that I had made based on those linked values were what was slowing me down so much. Basically, the workbook was recalculating once for every sequential link that got updated. So, I just disable calculation while updating the links, then reenabled calculation afterwards:

    Code:
    Dim xlCalc As XlCalculation
    
    
    
        xlCalc = Application.Calculation
    
        Application.Calculation = xlCalculationManual
    
    
    ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
    
    Application.Calculation = xlCalculationAutomatic
    Thanks for the dirty solution - it was just what I needed to kick-start my brain again.

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Updatelinks Only in One Worksheet

    Great. If your query is solved the do remember to mark the thread resolved. Check my signature on how to do it
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    27

    Re: [RESOLVED] Updatelinks Only in One Worksheet

    Oh, I remember. You've helped me a million times.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width