Consulting

Results 1 to 3 of 3

Thread: Solved: Runing a macro by clicking on a sheet

  1. #1
    VBAX Regular
    Joined
    Apr 2011
    Posts
    43
    Location

    Solved: Runing a macro by clicking on a sheet

    Hi,

    so far you have been very helpfull, so I hope you will help me with this problem also

    I need to run macros by clicking on a certain worksheet.

    So far I have got this:
    [VBA]Sub Worksheet_Activate()
    Call ColorBackgorund
    Call SetColour
    Call RecalculateColor
    End Sub[/VBA]

    Can it be done, to call the whole Module2, where all the subs are.
    And i need it to activate on clicking on worksheet "Performance Report"

    thanks in advance!

  2. #2
    VBAX Regular
    Joined
    Apr 2011
    Posts
    43
    Location
    Fixed it myself!

    [VBA]Sub Worksheet_Activate()
    Call Module2.ColorBackground
    Call Module2.RecalculateColor

    End Sub
    [/VBA]

    if anyone will need this in the future, here it is!

    thanks again!

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You don't need to prefix with a Module name unless you use the same Sub name in other Modules. That is not something that I would recommend but if you do, prefixing is required.

    [vba]Sub Worksheet_Activate()
    ColorBackgorund
    SetColour
    RecalculateColor
    End Sub
    [/vba]

Posting Permissions

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