Thread: Rename sheet
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Rename sheet

AS long as you have XL2000 or above

Dim iPos as long
With ActiveCell
iPos = InStrRev(.Value, " ")
ActiveSheet.Name = Left(.Value, 1) & Mid(.Value, iPos + 1, 1)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"slc " wrote in message
...
I am trying to rename the active sheet with 1st character of firstname
and 1st character of lastname.

E.g. in cell K2, I have the staff name John A. Doe. I want the current
active sheet to be rename to JD (i.e. the 1st character of first and
last name respectively.

Tried doing this but it didn't work:

ActiveSheet.Name=CONCATENATE(LEFT(LEFT(K2,FIND("
",K2)-1),1),LEFT(RIGHT(K2,LEN(K2)-FIND("*",SUBSTITUTE(K2,"
","*",LEN(K2)-LEN(SUBSTITUTE(K2," ",""))))),1))

Always have error in the "FIND" function. Thanks in advance for your
help


---
Message posted from http://www.ExcelForum.com/