Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-27-2014, 11:34 PM
excelledsoftware excelledsoftware is offline Workbook data Names in VBA are string only? Windows 7 64bit Workbook data Names in VBA are string only? 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook data Names in VBA are string only? Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
Replace contents form 1 workbook with another based on simular data shabbaranks Excel 1 12-05-2012 11:11 PM
Workbook data Names in VBA are string only? macro to transfer data from one workbook to another workbook virsojour Excel Programming 5 02-01-2011 08:58 PM
inserting a string of data into an MS Word table??? matto Word VBA 0 07-16-2010 09:35 AM
Workbook data Names in VBA are string only? How do I merge data from one sheet in a workbook out into multiple sheets nolesca Excel 4 06-07-2010 08:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:54 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft