+ Reply to Thread
Results 1 to 4 of 4

macro to be available for some workbooks

  1. #1
    Registered User
    Join Date
    12-08-2005
    Posts
    19

    Unhappy macro to be available for some workbooks

    When I'm recording macro in excel the macro is available to other workbook, but when I'm typing the code in v.b. the macro is available only to the specific workbook it wroten in. I have no idea why dose it's happend

  2. #2
    Tom Ogilvy
    Guest

    Re: macro to be available for some workbooks

    If I did Insert =>Module, then in that module I place code like

    Sub Dothings()
    msgbox "In Dothings"
    End Sub

    then as long as the workbook containing that macro is open, it would
    available like your recorded macros.

    If you are declaring your sub as private or putting in arguments or using
    sheet modules or the thisworkbook module, then your code would probably not
    be available.

    --
    Regards,
    Tom Ogilvy

    "ditzafar" <[email protected]> wrote in
    message news:[email protected]...
    >
    > When I'm recording macro in excel the macro is available to other
    > workbook, but when I'm typing the code in v.b. the macro is available
    > only to the specific workbook it wroten in. I have no idea why dose
    > it's happend
    >
    >
    > --
    > ditzafar
    > ------------------------------------------------------------------------
    > ditzafar's Profile:

    http://www.excelforum.com/member.php...o&userid=29475
    > View this thread: http://www.excelforum.com/showthread...hreadid=491889
    >




  3. #3
    Registered User
    Join Date
    12-08-2005
    Posts
    19
    Is this code including things that's make him to be not avialable?
    Sub macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 06/12/2005 by test2

    i = 2
    Do Until IsEmpty(Sheet1.Cells(i + 1, 3))
    Sheet1.Cells(i, 6) = Sheet1.Cells(i + 1, 3) - Sheet1.Cells(i, 3)
    i = i + 1
    Loop

    i = 2
    Do Until IsEmpty(Sheet1.Cells(i + 1, 3))
    Sheet1.Cells(i, 7) = Abs(Sheet1.Cells(i, 6))
    i = i + 1
    Loop



    Sum = 0
    For j = 2 To i
    Sum = Sum + Sheet1.Cells(j, 7)
    Next
    Sheet1.Cells(j + 2, 7) = Sum




    End Sub

  4. #4
    Tom Ogilvy
    Guest

    Re: macro to be available for some workbooks

    No. If placed in any open workbook in a general module, it will be visible
    in Tools=>Macro=>Macros.

    As others have stated, the personal.xls workbook is provided as a convenient
    location for locating macros which you want available each time you open
    excel as excel automatically opens the personal.xls workbook when it is
    opened. Otherwise, you would need to open whichever workbook contains that
    macro - then it would be available as well.

    --
    Regards,
    Tom Ogilvy

    "ditzafar" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Is this code including things that's make him to be not avialable?
    > Sub macro1()
    > '
    > ' Macro1 Macro
    > ' Macro recorded 06/12/2005 by test2
    >
    > i = 2
    > Do Until IsEmpty(Sheet1.Cells(i + 1, 3))
    > Sheet1.Cells(i, 6) = Sheet1.Cells(i + 1, 3) - Sheet1.Cells(i, 3)
    > i = i + 1
    > Loop
    >
    > i = 2
    > Do Until IsEmpty(Sheet1.Cells(i + 1, 3))
    > Sheet1.Cells(i, 7) = Abs(Sheet1.Cells(i, 6))
    > i = i + 1
    > Loop
    >
    >
    >
    > Sum = 0
    > For j = 2 To i
    > Sum = Sum + Sheet1.Cells(j, 7)
    > Next
    > Sheet1.Cells(j + 2, 7) = Sum
    >
    >
    >
    >
    > End Sub
    >
    >
    > --
    > ditzafar
    > ------------------------------------------------------------------------
    > ditzafar's Profile:

    http://www.excelforum.com/member.php...o&userid=29475
    > View this thread: http://www.excelforum.com/showthread...hreadid=491889
    >




+ Reply to Thread

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