+ Reply to Thread
Results 1 to 6 of 6

VBA Large If Then Else and Autopopulate help

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Hill AFB, Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    VBA Large If Then Else and Autopopulate help

    Hey everyone,

    I've searched this forum and I haven't found an exact answer to my question; sorry if this is found somewhere else, but here it is:

    For my job I have to get rid of a lot of HDDs(1400 of them, and growing every day).

    In excel I have to scan the serial number into the "A" column, then "B" is the make of the HDD, and "C" is the model.

    This is extremely time consuming.

    I noticed that the first 4 characters of the S/N for the HDD corresponds to the make and model. So, for a Western Digital HDD, model WD2500AAJS, the S/N is WMAV2A983220.

    I can't figure out, in VBA, how to code an IF statement that first looks for that string of 4 characters at the beginning(WMAV) and then populates the Make and Model in adjacent cells in the same row, from a list of what different Makes and Models it could be.

    I have about 50-90 different models of HDDs. Also, if the S/N doesn't correspond to any of them (FALSE) I need it to write "Unknown" in both fields.

    If someone could get me started on this, I'd appreciate it greatly.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Large If Then Else and Autopopulate help

    I am sure you will get help, but it would be easier for anyone to see if you could attach a sample with a desired result. You do not need to put the whole data-just a sample with dummy data.

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    Hill AFB, Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: VBA Large If Then Else and Autopopulate help

    Thanks, here is a sample of the excel with the 3 fields I'm having trouble with: S/N, Make, Model.

    Hopefully this helps you help me, haha.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: VBA Large If Then Else and Autopopulate help

    Hi,

    you can do that without VBA code, with a simple VLOOKUP. I made an example workbook for you.

    Edit: I didn't see the last two posts, but still...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-29-2012
    Location
    Hill AFB, Utah
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: VBA Large If Then Else and Autopopulate help

    HRCPgergo,

    Thanks so much! That's exactly what I needed.
    Rep'd.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA Large If Then Else and Autopopulate help

    @ Hernandez248

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1