Results 1 to 3 of 3

Worksheet_Calculation triggered by drop down box

Threaded View

  1. #1
    Registered User
    Join Date
    12-22-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    2

    Worksheet_Calculation triggered by drop down box

    Hi,
    I am having issues with getting some code to work. I am very new to this so I could be making stupid mistakes and I'm hoping there's an easy solution!
    What I am trying to do is trigger an event when a cell changes, and this cell is updated via a linked drop-down box.
    The issue is that the code seems to work fine (in about 10 seconds or less) if a manual calculation is entered into the sheet - but when it's done via the drop-down box, it takes about 3 minutes to complete the macro.

    To trigger the event, I am using:
    Private Sub Worksheet_Calculate()
    
    Application.Calculation = xlCalculationManual
    
    Module1.CopySheets
    
    Application.Calculation = xlCalculationAutomatic
    
    End Sub
    
    
    and CopySheets is:
    
    Sub CopySheets()
    
    
    Application.Calculation = xlCalculationManual
    
    
        Dim MenuType As String
        MenuType = Sheets("Menus").Range("D34")
        
        Sheets("SHEET1-" & MenuType).Select
        Range("A1").Select
        Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
        Selection.Copy
        Sheets("COPY1").Select
        Range("A1").Select
        ActiveSheet.Paste
    
        Sheets("SHEET2" & MenuType).Select
        Range("A1").Select
        Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
        Selection.Copy
        Sheets("COPY2").Select
        Range("A1").Select
        ActiveSheet.Paste
        
    
    Application.Calculation = xlCalculationAutomatic
    
    End Sub
    So basically, when the drop down box is changed, it links to MENUS!D34 and then the appropriate SHEETS are found and copied into COPY sheets. As mentioned, this code runs perfectly fine (and fast!) if I MANUALLY type a calculation into the MENUS tab, but once it uses the drop down box it runs extremely slowly.

    Any suggestions? Apologies if it's a long-winded question!!

    Any help appreciated!!
    Last edited by Leith Ross; 12-22-2009 at 02:17 AM. Reason: Added Code Tags

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