+ Reply to Thread
Results 1 to 8 of 8

Macro to Update Table Row Data only if Not Blank

  1. #1
    Forum Contributor
    Join Date
    01-16-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    171

    Macro to Update Table Row Data only if Not Blank

    In the attached workbook, on the Updates worksheet, the third column has a simple VLOOKUP formula that pulls clothing information from the Clothing worksheet.

    I need a way to allow users to enter data into the fourth "New Values" column and update the relevant cell only if the cell in the "New Values" column is not blank. I also need the date in the "Date Updating" cell to override the Update Date in the relevant row in the Clothing worksheet.

    Example:
    -User selects "Jane Doe" from the list of residents. Jane's waist size has changed from 22 to 24, but nothing else has changed.
    -User enters a date of 1/8/2024 in C3 (next to "Date Updating")
    -User enters "24" for Jane's waist size in the cell next to her old waist size in the "New Values" column.
    -User presses the "Update" button.
    -On the Clothing worksheet, the value in the Waist Size column for Jane Doe is updated to 24, and the value in the Update Date column for Jane Doe is updated to 1/8/2024.

    I really appreciate any help with this!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Macro to Update Table Row Data only if Not Blank

    See next code and file attached
    Please Login or Register  to view this content.
    Attached Files Attached Files
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Re: Macro to Update Table Row Data only if Not Blank

    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  4. #4
    Forum Contributor
    Join Date
    01-16-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    171

    Re: Macro to Update Table Row Data only if Not Blank

    Thank you very much, PCI and sintek! Both options worked exactly as I needed. I went with PCIs version since it correctly assumed that I need some validation to ensure that the user selects a name and enters a date.

    PCI, for some reason the error message to alert the user to a missing update date is not working. Running the macro allows me to add the information to the Clothing table without a date, and if I do so, the date in the ClothingTable reverts to 01/00/1900. It looks like it should work so I am not sure why the alert is not showing.

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Re: Macro to Update Table Row Data only if Not Blank

    All good...
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-16-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    171

    Re: Macro to Update Table Row Data only if Not Blank

    sintek, that works perfectly! Thank you so much for replying so quickly with such an elegant solution. I really appreciate your help and expertise!

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Macro to Update Table Row Data only if Not Blank

    Just to finish the story, in case someone would like to use the code
    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Thx for the Rep

  8. #8
    Forum Contributor
    Join Date
    01-16-2020
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    171

    Re: Macro to Update Table Row Data only if Not Blank

    Oh wow, extra comma haha. Happens to the best of us; thanks for the follow-up PCI!

+ 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. [SOLVED] update macro when new data is added to a table
    By sharky1978 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-13-2023, 04:25 AM
  2. Macro to update data in a table on master data sheet?
    By And180y in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2020, 06:16 PM
  3. running macro - 'calculate' does not update data table
    By umbata in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2016, 10:37 AM
  4. Macro to update another sheet from input data with blank lines
    By deweyirl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2014, 02:48 PM
  5. Macro to update excel data table in power point
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2014, 08:13 AM
  6. Macro to refresh pivot table and update data source
    By TBO in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2013, 01:09 PM
  7. Macro to update pivot table data range
    By Mike_M in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2005, 11:06 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