Consulting

Results 1 to 8 of 8

Thread: VBA Needed? Auto populate cells with hard-coded value

  1. #1
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    5
    Location

    VBA Needed? Auto populate cells with hard-coded value

    Hey everyone!

    I need some help here with Excel 2007, the scenario is like this. I have 2 different excel file, where I should map it into one hence I have a set of values for example:

    0001 = Pajamas
    0002 = Sweater
    0003 = T-Shirt
    0004 = Jacket
    0005 = Hat

    In my file(A), my values are Pajamas, Sweater and etc. where in a separate file I have values 0001 = Pajamas, 0002 = Sweater, 0003 = T-Shirt and etc. Is there a way, I can hard-code the values in my file (A) to auto populate the numbers if its Pajamas, then auto-populate '0001' next to the cell.

    I'm pretty new to excel and vba, but I'm happy to hear ideas to go around this and help would be very much appreciated! Thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    It is possible, but can we see the workbooks, to be sure of the data structures.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    5
    Location
    Hey! Sorry for the late reply but basically, I have 2 workbooks to work with but it only allows me to upload one though Nevertheless, if you open the workbook, look at the column R, S, T, U

    I have another workbook, with these values and I would like map it accordingly to column, for example column R = TTP11, so I wish to add a column next to it with the value "Agapanthus", which pushes S to T and so on. Is that possible?
    TTP11 = Agapanthus
    Attached Files Attached Files

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Shame about the other one, but would it not just be

    =VLOOKUP(R2,'[other workbook.xls]Sheet1'!$A:$C,2,FALSE)

    etc.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    5
    Location
    Alright, posted the second workbook, basically if my column R in first workbook matches with column C in my second workbook, then I want it to create a new column next to R which is S, to paste column D (information).

    Hope it's not confusing
    Attached Files Attached Files
    Last edited by khertz; 08-06-2011 at 01:23 AM.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Can you post the second workbook now then?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    5
    Location
    Alright, edited my second post with updated information.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    This works fine for me

    =VLOOKUP(R2,[Book2.xlsx]Sheet1!$C:$E,2,FALSE)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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