![]() |
Adding new sheet problem-Macro
I'm very new to this. I'm trying to open a new worksheet and call it a name. However, I never know what sheet name excel is going to give me: sometimes "Sheet1" or "Sheet10". It depends on how many times I run the macro. Is there a way to convert this: ' Workbooks.Add Sheets("Sheet1").Name = "M1" to something more friendly? -- pikapika13 ------------------------------------------------------------------------ pikapika13's Profile: http://www.excelforum.com/member.php...o&userid=10892 View this thread: http://www.excelforum.com/showthread...hreadid=527159 |
Adding new sheet problem-Macro
one way:
With Worksheets.Add On Error Resume Next 'in case M1 exists .Name = "M1" On Error GoTo 0 End With In article , pikapika13 wrote: I'm very new to this. I'm trying to open a new worksheet and call it a name. However, I never know what sheet name excel is going to give me: sometimes "Sheet1" or "Sheet10". It depends on how many times I run the macro. Is there a way to convert this: ' Workbooks.Add Sheets("Sheet1").Name = "M1" to something more friendly? |
Adding new sheet problem-Macro
When the sheet's first made, it's the active sheet so I'd change the second
line to: ActiveSheet.Name = "M1" "pikapika13" wrote: I'm very new to this. I'm trying to open a new worksheet and call it a name. However, I never know what sheet name excel is going to give me: sometimes "Sheet1" or "Sheet10". It depends on how many times I run the macro. Is there a way to convert this: ' Workbooks.Add Sheets("Sheet1").Name = "M1" to something more friendly? -- pikapika13 ------------------------------------------------------------------------ pikapika13's Profile: http://www.excelforum.com/member.php...o&userid=10892 View this thread: http://www.excelforum.com/showthread...hreadid=527159 |
All times are GMT +1. The time now is 12:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com