Hi
I have a form where the user selects a name from a drop down list (Name from NameList) which then copies all the records for that person to a separate sheet.
What I want to do is rename the new worksheet using a shortened version of the Name.
I need some code which looks something like this but I'm not sure of the correct syntax:
Dim Shortname
Dim Name
Name = cmbName.Value (Name = the value from the drop down menu e.g Aaaaaaaaaaaaaaaaaa)
Shortagent = VLOOKUP(Name,NameList,2,FALSE)
Sheets.Add.Name = "Report_" & Shortname
-----------------------------------
NameList (which is stored on a worksheet within the spreadsheet)
Name...............................Short Name
Aaaaaaaaaaaaaaaaaa...............A
Bbbbbbbbbbbbbbbbbb...............B
Cccccccccccccccccc...................C
Dddddddddddddddddd...............D
Eeeeeeeeeeeeeeeeee................E
So if the user selects Aaaaaaaaaaaaaaaaaa from the form's drop down menu, the worksheet is renamed Report_A
Can anyone help me please
Thanks
J
I have a form where the user selects a name from a drop down list (Name from NameList) which then copies all the records for that person to a separate sheet.
What I want to do is rename the new worksheet using a shortened version of the Name.
I need some code which looks something like this but I'm not sure of the correct syntax:
Dim Shortname
Dim Name
Name = cmbName.Value (Name = the value from the drop down menu e.g Aaaaaaaaaaaaaaaaaa)
Shortagent = VLOOKUP(Name,NameList,2,FALSE)
Sheets.Add.Name = "Report_" & Shortname
-----------------------------------
NameList (which is stored on a worksheet within the spreadsheet)
Name...............................Short Name
Aaaaaaaaaaaaaaaaaa...............A
Bbbbbbbbbbbbbbbbbb...............B
Cccccccccccccccccc...................C
Dddddddddddddddddd...............D
Eeeeeeeeeeeeeeeeee................E
So if the user selects Aaaaaaaaaaaaaaaaaa from the form's drop down menu, the worksheet is renamed Report_A
Can anyone help me please
Thanks
J