Results 1 to 7 of 7

Difference between an event driven macro and a module macro

Threaded View

RamblinWreck Difference between an event... 07-18-2007, 12:36 PM
royUK Please use Code Tags in... 07-18-2007, 01:11 PM
RamblinWreck Thanks much. Your macro... 07-18-2007, 01:57 PM
Norie Tony To explain it might... 07-18-2007, 02:07 PM
RamblinWreck The first range command in my... 07-18-2007, 02:30 PM
Norie Tony The problem isn't... 07-18-2007, 02:54 PM
RamblinWreck Norie: Thanks so much for... 07-18-2007, 03:42 PM
  1. #1
    Registered User
    Join Date
    03-25-2004
    Posts
    4

    Difference between an event driven macro and a module macro

    I created a macro to copy data from one worksheet and paste it to a different worksheet. The macro below works fine when I run it from a "module" (terminology ?). However, when I run the macro from an event driven macro (like from combo box), the macro bombs.

    I was able to get the macro to work by having the event driven macro just call the module macro, but I would like to understand what is going on. I suspect that it's related to variable scope, but I am a newbie wrt Excel Macros.

    Any ideas ?

    I have also attached a sample workbook.

    Thanks in Advance.

    RW

    ***********
    Macro is below
    ***********
    Sub Macro1()
    Sheets("Sheet2").Select
        Range("E6:E9").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet5").Select
        Range("H7").Select
        ActiveSheet.Paste
    End Sub

    Please read forum rules and wrap your code
    Attached Files Attached Files
    Last edited by VBA Noob; 07-18-2007 at 01:25 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