ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to name the list (https://www.excelbanter.com/excel-programming/353880-how-name-list.html)

Toman

How to name the list
 

Hello guys
I need help. I am trying to write my first VBA code. First complicatio
has already occured :-).
I want to name the list after cell, including cellīs forma
(00"/"0000"/"00)

I use this simple code but doesnīt work properly:

Private Sub CommandButton2_Click()
ActiveSheet.Name = ActiveSheet.Range("B1").Value
End Sub



For instance: The cell has content : 05/4103/01 and I need to get thi
into Listīs name field.

My procedure returns only 5410301 as a List name


Thank you for your advice

--
Toma
-----------------------------------------------------------------------
Toman's Profile: http://www.excelforum.com/member.php...fo&userid=3139
View this thread: http://www.excelforum.com/showthread.php?threadid=51479


Norman Jones

How to name the list
 
Hi Toman

The slash (/) is not a legal sheet name character.

Changing the slash for (say) a hyphen, your code worked for me.


---
Regards,
Norman


"Toman" wrote in
message ...

Hello guys
I need help. I am trying to write my first VBA code. First complication
has already occured :-).
I want to name the list after cell, including cellīs format
(00"/"0000"/"00)

I use this simple code but doesnīt work properly:

Private Sub CommandButton2_Click()
ActiveSheet.Name = ActiveSheet.Range("B1").Value
End Sub



For instance: The cell has content : 05/4103/01 and I need to get this
into Listīs name field.

My procedure returns only 5410301 as a List name


Thank you for your advices


--
Toman
------------------------------------------------------------------------
Toman's Profile:
http://www.excelforum.com/member.php...o&userid=31397
View this thread: http://www.excelforum.com/showthread...hreadid=514795




Norman Jones

How to name the list
 
Hi Toman,

Changing the slash for (say) a hyphen, your code worked for me.


Or, more explicitly:

ActiveSheet.Name = _
Format(ActiveSheet.Range("B1").Value, "00-0000-00")


---
Regards,
Norman



Toman[_2_]

How to name the list
 

Thank you guys.
Now it is working perfectly;)


--
Toman
------------------------------------------------------------------------
Toman's Profile: http://www.excelforum.com/member.php...o&userid=31397
View this thread: http://www.excelforum.com/showthread...hreadid=514795



All times are GMT +1. The time now is 10:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com