+ Reply to Thread
Results 1 to 4 of 4

Macro to change cell contents based on another cell in the same row

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Macro to change cell contents based on another cell in the same row

    Hello,

    I have an Excel 2010 template that I've created.
    Data is added to the "data" tab every day and the number of rows varies daily. I need a macro that will:
    1) amend column H depending on the corresponding row in column I - eg, if I2 says "ABC*" then H2 needs to say "123". If I2 says XYZ* then H2 needs to say 789. There are about 3 or 4 criteria but I can manipulate these once I have the base code I think.

    Once this has been done I need the macro to refresh all pivots (on other tabs in the same workbook) and then "save as" xlsx (no macro's required) in a particular network location \\share\folder\folder with a specific filename: eg. this is the filename ddmmyy.xlsx where the user can enter the required date in the filename.

    I'm very comfortable with Excel formula's and manipulating code that's already there but have no idea how to create code from scratch!! I'm hoping one of you geniuses will be able to help!!

    I need a smiliar bit of code for some other workbooks so if I can get someone that will work for this I'm hoping I'll be able to amend it for the other workbooks!

    Thanking you in advance...

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

    Re: Macro to change cell contents based on another cell in the same row

    1) How to test for certain beginning values in a cell:

    Please Login or Register  to view this content.

    2) How to refresh all the pivot tables in the workbook:
    Please Login or Register  to view this content.

    3) How to prompt a user for a date and feed it into a filename:
    Please Login or Register  to view this content.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Macro to change cell contents based on another cell in the same row

    Thank you for that!!!

    If I wanted to run all that as a single macro, can I just copy and paste them one after the other or do they need to be separate?

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

    Re: Macro to change cell contents based on another cell in the same row

    That's up to you. THose are snippets. It is presumed you will piece together what you need into a single macro. I would be sure to put the DIMs from each snippet together at the top of your macro with your other DIMs. Go slow, put the pieces together and test one addition at a time until you have the whole macro assembled to your liking.

+ 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