Consulting

Results 1 to 4 of 4

Thread: Reading Tag name, editing it and saving.

  1. #1
    VBAX Regular
    Joined
    May 2006
    Posts
    33
    Location

    Reading Tag name, editing it and saving.

    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 !


    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 ?

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    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

  3. #3
    VBAX Regular
    Joined
    May 2006
    Posts
    33
    Location

    Thank you!

    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!

  4. #4
    Knowledge Base Approver
    The King of Overkill! VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Great! If you run into anything that doesn't "fit the mold", let us know and we can take a closer look.
    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •