+ Reply to Thread
Results 1 to 6 of 6

VBA to populate data / merging data & If Blank populate data

  1. #1
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    VBA to populate data / merging data & If Blank populate data

    Hi

    I hope someone can help, I just don't seem to be able to produce a macro that will work for the problem I have.

    I have a macro that works great below:-

    Please Login or Register  to view this content.

    Now I need to make some additions to this to make the following changes :-

    1. Insert 5 columns at the start, in the header row call these (in this order)
    Col A = Service Reference
    Col B = Service
    Col C = Service Enhancement
    Col D = Service Format
    Col E = Service Class

    2. Every row (with existing data) in the sheet then needs to be populated with the following data:

    Col A = 1
    Col B = PK1
    Col C = blank
    Col D = P
    Col e = 1st

    3. I then need to merge the surname into the first name column so we have first name and last name together (cols P and Q)


    4. In Col V I need it to If cell = United Kingdom make the cell blank but If cell = France, change to FR


    5. For Col AD (weight) if col V is blank populate 750 but if Col V shows FR then populate 220


    Iv'e been searching for answers for days and trying different options but I am completely stuck.


    I have attached the raw data example sheet and an example of how the results should look also.


    All help is appreciated.


    Many thanks

    Jon
    Attached Files Attached Files
    Last edited by endoskeleton; 09-08-2011 at 01:19 PM.

  2. #2
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Re: VBA to populate data / merging data & If Blank populate data

    Hi everyone

    Any pointers, even on part of the puzzle, would be great.

    Thx

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA to populate data / merging data & If Blank populate data

    Try this:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 09-08-2011 at 12:57 PM. Reason: Correction for missing countries
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Re: VBA to populate data / merging data & If Blank populate data

    Hi Jerry

    That is awesome, thank you so much. I just noticed one slight problem.

    If the file does not contain any shipments to France it returns an error that it could not find any data.

    Can this be resolved so that if we had a shipment day with no orders to France (or indeed to the UK) it would simply continue on running and not return the error

    Cheers

    Jon

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA to populate data / merging data & If Blank populate data

    Edited above.

  6. #6
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Re: VBA to populate data / merging data & If Blank populate data

    thank you so much for your help.

+ 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