Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Get WorkSheet Name without a reason
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Get WorkSheet Name without a reason
Hi Mike,
Thanks for your reply. I have the same code. But it still fails to work without opening the code and refresh. Heres my code: Sub WsNames() Dim i As Long Dim Sh As Worksheet i = 6 For Each Sh In ActiveWorkbook.Sheets Range("B" & i) = Sh.Name Range("A" & i) = Sh.CodeName i = i + 1 Next End Sub Any idea to rectify? Thanks DC |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Column Widths Changing - For No Reason??? | Excel Discussion (Misc queries) | |||
No reason for Large excel file-don't know why | Excel Discussion (Misc queries) | |||
Formulas in are turning into values for no reason | Excel Worksheet Functions | |||
Excel slows down for no(?) reason... | Excel Discussion (Misc queries) | |||
Any reason for no allowance of avatars?? | Excel Discussion (Misc queries) |