ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to be available for some workbooks (https://www.excelbanter.com/excel-programming/347646-macro-available-some-workbooks.html)

ditzafar

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


--
ditzafar
------------------------------------------------------------------------
ditzafar's Profile: http://www.excelforum.com/member.php...o&userid=29475
View this thread: http://www.excelforum.com/showthread...hreadid=491889


Tom Ogilvy

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" wrote in
message ...

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




ditzafar[_3_]

macro to be available for some workbooks
 

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


Tom Ogilvy

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" wrote in
message ...

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





All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com