sheet names in cells.. also macro names came...


Posted by Pasi Vartiainen on April 16, 2000 11:56 PM

I have macro, which code is found in this excelent message board:

Dim sh, x As Integer
For Each sh In ThisWorkbook.Sheets
Cells(x + 1, 1) = sh.Name
x = x + 1
Next

This macro writes sheet names to cells. The problem is that this macro also writes "modele"", "module2", etc. to cells. So, it also sees macros.. is there any easy way to prevent macros "module1" to print to cell?

Preventing module seen isn't vital, but it looks kind of silly...

Waiting for answers..
Pasi

Posted by Celia on April 17, 2000 3:58 PM

Pasi
I've just run your exact code. It only printed the worksheet names and not the module names, although I don't know why.
However, you could try :-

Dim sh As Worksheet, x As Integer
For Each sh In ThisWorkbook.Worksheets
Cells(x + 1, 1) = sh.Name
x = x + 1
Next

Celia

Posted by Pasi Vartiainen on April 28, 2000 12:32 AM

Thanks.

Thank you Celia, your code work's. Now the module's are no longer printed.

*humbly bows to Celia and gives a rose: @>-}-}--* :)



Posted by Ivan Moala on May 05, 2000 2:27 PM

Re: Thanks.


Hi Pasi
I also noted your macros plus your other postings
Re: sheets names and modules.
The reason your modules were been printed was due to the fact that
you were running it from another workbook and not the active macro workbook.