#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Can anyone

Hi All,

I got one macro, which I pasted in my module but if I want to run that
macro,
the macro name is not visible. Or how do check the result to be
appeared in immediate window ?

Sub LoopThruSheetsBookX(BookX$)
Dim sh As Sheet
For Each sh In Workbooks(BookX$)
Debug.Print sh.Name
Next sh
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default Can anyone

When you pasted the code into VBA you either put the code on a worksheet or
thisworkbook. You need to put your code into a mode. view the Project
Explorer from the VBA (select Prject Explorer from the View Menu). You will
see there is a sheet for each spreadsheet and thisworkbook. You can also
create Modules. go to Insert Module to add the module. then move you code
from the shet to the module. You can double click on any of these VBA
objects to view the code.

" wrote:

Hi All,

I got one macro, which I pasted in my module but if I want to run that
macro,
the macro name is not visible. Or how do check the result to be
appeared in immediate window ?

Sub LoopThruSheetsBookX(BookX$)
Dim sh As Sheet
For Each sh In Workbooks(BookX$)
Debug.Print sh.Name
Next sh
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Can anyone

From Visual Basic Editor windows; from Insert menu insert a module and paste
your code. Save and close. Get back to workbook. Check macros..
--
If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Hi All,

I got one macro, which I pasted in my module but if I want to run that
macro,
the macro name is not visible. Or how do check the result to be
appeared in immediate window ?

Sub LoopThruSheetsBookX(BookX$)
Dim sh As Sheet
For Each sh In Workbooks(BookX$)
Debug.Print sh.Name
Next sh
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Can anyone

Macros that take arguments are not 'runnable" other than through other code.
For example, you can pass a workbook object to your sub by using one of the
line from something like this:

Sub Test()
LoopThruSheetsBookX ActiveWorkbook
LoopThruSheetsBookX Workbooks("Name.xls")
End Sub

Sub LoopThruSheetsBookX(BookX$)
.....


HTH,
Bernie
MS Excel MVP
wrote in message
...
Hi All,

I got one macro, which I pasted in my module but if I want to run that
macro,
the macro name is not visible. Or how do check the result to be
appeared in immediate window ?

Sub LoopThruSheetsBookX(BookX$)
Dim sh As Sheet
For Each sh In Workbooks(BookX$)
Debug.Print sh.Name
Next sh
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Can anyone

I'm sorry, I ignored your string use - though BookX was an object:

Sub Test()
LoopThruSheetsBookX ActiveWorkbook.Name
LoopThruSheetsBookX "Name.xls"
End Sub.

Sub LoopThruSheetsBookX(BookX As String)
Dim sh As Sheet
For Each sh In Workbooks(BookX)
Debug.Print sh.Name
Next sh
End Sub

Bernie

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Macros that take arguments are not 'runnable" other than through other
code. For example, you can pass a workbook object to your sub by using one
of the line from something like this:

Sub Test()
LoopThruSheetsBookX ActiveWorkbook
LoopThruSheetsBookX Workbooks("Name.xls")
End Sub

Sub LoopThruSheetsBookX(BookX$)
....


HTH,
Bernie
MS Excel MVP
wrote in message
...
Hi All,

I got one macro, which I pasted in my module but if I want to run that
macro,
the macro name is not visible. Or how do check the result to be
appeared in immediate window ?

Sub LoopThruSheetsBookX(BookX$)
Dim sh As Sheet
For Each sh In Workbooks(BookX$)
Debug.Print sh.Name
Next sh
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"