View Single Post
 
Old 01-27-2014, 11:34 PM
excelledsoftware excelledsoftware is offline Windows 7 64bit Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Wow this was certainly informational. I am sure you thought of this solution but I will post what I would do so others reading this forum can see.

I don't think there is a way to get just the integer value from a name since I believe a name is always a string. This can be verified by trying a Shape Name. I tried entering a shape with the name 6 but it still goes to "6". I think that names have to be strings so they can be referred to in any MS program. Similar to if you use a mid formula on group of numbers it now becomes a string and you have to add 0 to it to bring it back to a number. Good ol' data types.

Here is the solution I would suggest that you could put at the beginning of your Sub and then you can use the same variable name throughout your code.

Code:
SalChk = Mid(ThisWorkbook.Names("SalChk"), 2) + 0
SalCln = Mid(ThisWorkbook.Names("SalCln"), 2) + 0
SalCrew = Mid(ThisWorkbook.Names("SalCrew"), 2) + 0
SalMech = Mid(ThisWorkbook.Names("SalMech"), 2) + 0
SalPilot = Mid(ThisWorkbook.Names("SalPilot"), 2) + 0
SalSpv = Mid(ThisWorkbook.Names("SalSpv"), 2) + 0
By the way this same thing can be achieved using mid and Cstr, or replace and + 0 it looks like there are lots of ways but it does not look like a name can have just a number value since it will always add on that equals sign to make it a string.

If anybody else finds out different please let us all know.

Thanks
Reply With Quote