+ Reply to Thread
Results 1 to 13 of 13

Macro to look up cell in table and paste relevant information.

  1. #1
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Macro to look up cell in table and paste relevant information.

    Hey,

    what I have is a list of selected employees, with the site they work at next to them.

    What I need is a macro which looks at the site they work at, references it with an address table in a separate worksheet and then pastes the site address along with the employee's name onto a thrid worksheet which will be used to print post labels.

    >Look at which site the employee works at (Sheet 1, D:D)
    >Find the address of said site (Sheet 3)
    >Paste the relevant address along with the employees name (Sheet 1, B:B) into a separate worksheet.

    This will be done weekly, and I need the macro to either only work on the latest's weeks table, or to just work with the current active selection.

    If you can think of a better way round this problem, a better way to lay out my table, absolutely anything that will help, please say as nothing is set in stone. Also if I haven't explained myself well enough please feel free to ask any questions.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to look up cell in table and paste relevant information.

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    That works quite well, I would prefer it to run it for just the active selection though if possible, Also could you have it so it prints the addresses in the format of the attached spreadsheet. As they need to be printed off onto labels sheets, the sheets are set out so there are 2 columns of labels and 7 rows on an A4 sheet, making each label 99mmx38mm. Pretty much exactly the same as the image linked.
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    I also have some 3x6 sticker sheets (63.5mm x 46.6mm) which I could also use.
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to look up cell in table and paste relevant information.

    Quote Originally Posted by jimbobakoo View Post
    I also have some 3x6 sticker sheets (63.5mm x 46.6mm) which I could also use.
    Can you provide a row height and column width of your sample per excel measurements?

  6. #6
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    I'm doing some tests now to find out what sizes I need the rows/cells. It's really difficult, anyone know an easy way of doing this? At the moment the best I have come up with is trial and error.

  7. #7
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    I have a word document which has it laidd out perfectly, not sure how to get this into excel though

  8. #8
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    This is pretty much all I have to work with (except for the actual label sheet, which I sent you a picture of.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    Oh damn, that's not even the right format, the columns are right, but there are 8 rows instead of 6! I'll try and find a relevant one, I have the sheets in front of me so I can provide any real life measurements

  10. #10
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    This one works, I just tested and everything fits on the labels. The word documents seems to have cells, is there anyway this could be copied over to an excel document?
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    Ok, sheet 5 works perfectly with my 3x6 label sheet, as long as they stay roughly in those confines (there is quite a bit of lee way) once printed it will fit onto my labels perfectly, sorry for the infinite spam on this thread, but I would still really appreciate any help.

    ... Does this help?
    Attached Files Attached Files
    Last edited by jimbobakoo; 05-19-2014 at 09:15 AM.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to look up cell in table and paste relevant information.

    I still can't match too the word measurements. And it only works on Column B. But test it on your first sample (post #1) and see if this is something you can use.

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 05-19-2014 at 10:25 AM.

  13. #13
    Registered User
    Join Date
    03-29-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Macro to look up cell in table and paste relevant information.

    Does the latest excel document I sent help? it has the right format in excel on sheet 5, also this macro still does the whole of the first tab rather than just the active selection.

    it also seems to be adding "If Undelivered Please Return to" which isn't needed.
    Last edited by jimbobakoo; 05-19-2014 at 10:22 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need to gather information from one sheet to have relevant info on another
    By TRLWNC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2014, 05:09 PM
  2. [SOLVED] Macro to cut and paste to different sheet based on a certain cell information
    By mmcgrail in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2013, 05:39 PM
  3. Run macro on many cells pull data from web paste results next to relevant cell
    By elpettey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2012, 01:44 PM
  4. [SOLVED] Macro to copy,paste and group information based on value in a cell
    By gullit in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2012, 05:32 PM
  5. Macro to sort data,match and paste in to relevant sheets on same workbook
    By Benjamin2008 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2009, 07:58 AM

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