Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
I have a file that i do not know how many sheet are there in before i need to copy contain of C4 to name of sheets Thank for your help. -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#2
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
For Each sh In Activeworkbook.Worksheets sh.Name = sh.Range("C4").Value Next sh -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vumian" wrote in message ... I have a file that i do not know how many sheet are there in before i need to copy contain of C4 to name of sheets Thank for your help. -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#3
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
hi, sorry, i fail to understand your mean Could you be more specific,pls Thank you. -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#4
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
Create and run that macro.
Will do the job. Unless you left something out of the original query. Steve On Tue, 25 Jul 2006 16:02:59 +0100, vumian wrote: hi, sorry, i fail to understand your mean Could you be more specific,pls Thank you. |
#5
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
thanks your idea, but here can not create macro coz i do not know how many sheet before ? How to use For statement here ? VBA only. thanks for your help. -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#6
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
Why VBA only,
Anyway I count Excel macros as VBA "For Each sh In Activeworkbook.Worksheets" That does the counting for you. On Tue, 25 Jul 2006 16:19:26 +0100, vumian wrote: thanks your idea, but here can not create macro coz i do not know how many sheet before ? How to use For statement here ? VBA only. thanks for your help. |
#7
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
Dim sh As Worksheets Sub GetName() For Each sh In ActiveWorkbook.Worksheets sh.Name = sh.Range("C4").Value Next sh End Sub It do not run. Why, help me pls -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#8
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
Works perfectly without the Dim statment - not needed
Steve On Tue, 25 Jul 2006 16:57:09 +0100, vumian wrote: Dim sh As Worksheets Sub GetName() For Each sh In ActiveWorkbook.Worksheets sh.Name = sh.Range("C4").Value Next sh End Sub It do not run. Why, help me pls -- Steve (3) |
#9
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
thank you very much, so great. man :) -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
#10
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
I would advise against suggesting that variables are not declared, poor
programming practice. The problem is that it should be declared as Worksheet against Worksheets, not that it shouldn't be declared. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "SteveW" wrote in message news:op.tc88mtjcevjsnp@enigma03... Works perfectly without the Dim statment - not needed Steve On Tue, 25 Jul 2006 16:57:09 +0100, vumian wrote: Dim sh As Worksheets Sub GetName() For Each sh In ActiveWorkbook.Worksheets sh.Name = sh.Range("C4").Value Next sh End Sub It do not run. Why, help me pls -- Steve (3) |
#11
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
Quite right Bob,
Just the end of a long line of replies :) On Wed, 26 Jul 2006 09:19:39 +0100, Bob Phillips wrote: I would advise against suggesting that variables are not declared, poor programming practice. The problem is that it should be declared as Worksheet against Worksheets, not that it shouldn't be declared. -- Steve (3) |
#12
Posted to microsoft.public.excel.newusers
|
|||
|
|||
How to use VBA to name sheet ?
hi everyone, with code above, there is a error as following: if value of C4 of every sheet same, it can not run code above. how to msgbox in case Sub GetName() For Each sh In ActiveWorkbook.Worksheets sh.Name =3D sh.Range("C4").Value if .... What is it here to msgbox, pls Next sh End Sub -- vumian ------------------------------------------------------------------------ vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494 View this thread: http://www.excelforum.com/showthread...hreadid=564347 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum up columns in different sheet with error check | Excel Discussion (Misc queries) | |||
Compiling macro based on cell values | Excel Discussion (Misc queries) | |||
lock tab in sheet 2 until cell in sheet one is completed | Excel Worksheet Functions | |||
Using a relative SHEET reference for source data in a chart | Charts and Charting in Excel | |||
linking multiple sheets to a summary sheet | Excel Discussion (Misc queries) |