View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Get WorkSheet Name without a reason

It could only be a guess without seeing the code but here's some that does
wotk that you could maybe adapt:-

Sub getnames()
x = 1
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Sheets("Sheet1").Cells(x, 1).Value = ws.Name
x = x + 1
Next ws
End Sub

Mike

"Dileep Chandran" wrote:

Hello Masters,

I have a macro which will get the list of worksheet names. It works
fine untill I add some more worksheets and run it again.

The craziest thing is that if I go to the code and simply add a space
of delete a space, or just cut and paste the code, it works fine.

Any idea what could be wrong??

Thanks in advance for any help

-DC