PDA

View Full Version : [SOLVED:] Reading Tag name, editing it and saving.



WebGuy
06-12-2006, 04:58 AM
Hi!

I have a small problem and i haven't got a clue how to solve it. Since you guys have helped me many times in the past, i figured that i might aswell ask you again. Here goes!

I want to move tags from one spreadsheet to another and in the process change their names.

I have 3 different tag names:
ME3440-05
HE3470-04
HE3490-05

Is there a quick & easy way to convert these tag names to 3440, 3470 & 3490 without using a case structure ?

Thanks !
:friends:

Oooh! a bonus question ! When comparing 2 tagnames or serial no., how do i do the comparison ignoring if the letters are upper or lower case ?

mvidas
06-12-2006, 06:39 AM
Hi WebGuy,

Do your tags always follow the format xx####-##? If so, you could use

NewTag = Mid(OldTag, 3, 4)If not, please let us know what the tag could be and we can help you determine the best way to extract what you want.

As for your bonus, take a look at the LCase() or UCase() functions, it converts a string to upper or lower case. When comparing two strings and case doesn't matter, you can use that or the StrComp function:

Dim String1 As String, String2 As String
String1 = "AaA"
String2 = "aAa"
Debug.Print LCase(String1) = LCase(String2)
Debug.Print StrComp(String1, String2, vbTextCompare) = 0 'returns 0 when matched

Matt

WebGuy
06-15-2006, 05:04 AM
Thanks ! You solved both my problems. I haven't had a chanse to try it out live as yet, but i did a small test run and it worked fine..
Thank you very much!
:clap:

mvidas
06-15-2006, 06:32 AM
Great! If you run into anything that doesn't "fit the mold", let us know and we can take a closer look.
Matt