+ Reply to Thread
Results 1 to 15 of 15

Log User Input In Successive Rows

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Log User Input In Successive Rows

    Hello,

    I am new to the Forums and need help with an application I would like to create.

    I am trying to build a user-friendly Excel database that takes the user's input from various cells and logs that data input by the user in successive rows to the side. Please see the screenshots of my current spreadsheet below:

    Compressor Database.jpg

    From the screenshot above, I would like for the user to input their data for the Date of Last Inspection, Current Hours, and check the boxes for any services they performed in the orange/pink "Input" box on the left. Currently I have the spreadsheet set up so that the orange/pink "input" areas recognize data put in to the yellow "Data Log" cells to the right. I am trying to get the yellow "Data Log" cell area to store the Date and Hours data put in by the user in successive rows like a database, but I am not sure how to do this. I was thinking of putting a button in the says "Log Data" which would, when clicked, store the data in the "Data Log" cells. I am unsure if I need to use a Macro or whether Excel has a simple, built-in function that can be used. Eventually I have plans for the "Date of Last _______ Change" Gray boxes, but would like to take this one step at a time.

    I am not well versed in VBA and Excel Macros, and I am currently using Microsoft Excel 2007 (yes, I know it is old). I do have C# and Matlab coding experience, however I would like to do this in Excel to make it easier for the User as it is a well known program.

    Thank you for any help or advice you can provide.

    Vergewaltiger
    Attached Files Attached Files
    Last edited by Vergewaltiger; 02-04-2014 at 10:46 AM. Reason: Picture needed to be updated

  2. #2
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    It's not always so easy to get the ranges correct with just a picture, but I think you idea about a button sounds good, take a look at this code:
    Please Login or Register  to view this content.
    Best regards

    Per Erik Midtr?d

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,683

    Re: Log User Input In Successive Rows

    Picture:

    Hi and welcome to the forum

    Please do not upload a picture of your file...rather, upload a sample of your workbook, showing what data you are working with, a few samples of your expected outcome (manually entered is ok) and how you arrived at that. (Exclude sensitive info). Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you. Also, not all members can upload picture files (Company firewalls, etc.)

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    See attached Excel sample below
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    There were som merged cells in your sheet, but try this code:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    Perimidt,

    Thank you for your advice, however I'm not sure where I should use the code you provided. Is that for the button I would put in for the user to log their data? I apologize for the stupid questions, I am not very experienced with Excel Macros or VBA. When I go to place a button and enter the code you provided, the first line does not match up with your code. This is what appears when I attempt to edit the button's code:

    Please Login or Register  to view this content.
    I'm not sure if I should try to record the Macro or input the code some other way.
    Last edited by alansidman; 02-04-2014 at 02:31 PM.

  7. #7
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    Try to paste this after Sub Button14_Click()

    Please Login or Register  to view this content.
    Last edited by alansidman; 02-04-2014 at 12:08 PM.

  8. #8
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    Perimidt,

    Thank you so much that works well! It does start at row 11, however. What should I change in the code to get it to start logging data at row 3?

  9. #9
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    I think there is some junk in those cells, just right click them and clear contents.

  10. #10
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    Perimidt,

    Wow, I apologize for the silly error. If you are willing and have the time, I have a few more things I would like to do with my spreadsheet.

    The next step would be when the user is inputting data and checks one of the boxes for "Oil Changed?", "Separator Changed?", or "Filter Changed?", to display the corresponding date of when that box was checked in the gray output boxes "Last Oil Change Date:", "Last Separator Change Date:", or "Last Oil Filter Change Date:", respectively. For example, if the date was entered as 1/25/2014, and the "Oil Changed?" box was checked, then the gray "Date of Last Oil Change" box would display 1/25/2014.

    Currently, I have the gray boxes set up with an "IF" function to display the last known date, but it only recognizes dates once and does not change.

    Again, thank you so much for your help, so far your advice has been invaluable.

    Vergewaltiger

  11. #11
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    I think you have to use the check-box from the ActiveX Controls, then you will have access to the click event and can use the following code for Oil Change:
    Please Login or Register  to view this content.
    Check the attached workbook as well.
    Log User Input In Successive Rows.xlsm

  12. #12
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    Perimidt,

    You are a wizard my friend, it worked perfectly!

    One more thing I would like to include is when a "Oil Change?", "Separator Change?", or "Filter Change?" box is checked, to include that in the data that is logged with the button and displayed in the "Data Log" table to the right. For example, if a user inputs the date as 1/17/2014, with hours of 1250, and checks the "Oil Change?" box, then clicks the Log Data button to store the data, the "Data Log" would display the Date and Hours (which already works) as well as display "Oil Changed" in the cell O3.

    See the attached workbook for an updated format.

    Vergewaltiger
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-26-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    67

    Re: Log User Input In Successive Rows

    Hi

    This is sort of tricky because you have to reference the sheet the ActiveX Control is on.
    My suggestion is to add it to the buttons click event, like this:
    Please Login or Register  to view this content.
    Just be aware that you cannot change the sheet-name.

  14. #14
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    Perimidt,

    I used the code you provided with some slight modifications to display the "Separator Change" and "Filter Change" messages in different cells. I provided the code below in case anyone else views this thread as a reference.

    Please Login or Register  to view this content.
    So far, with your help, my application is working perfectly, just the way I wanted it to! Thank you again Perimidt, I could not have done it without your help. If I have any other changes or additions I don't know how to make I'll be sure to post on this forum thread.

    Vergewaltiger

  15. #15
    Registered User
    Join Date
    01-28-2014
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Log User Input In Successive Rows

    I've run into a problem when trying to create another sheet for a different compressor. Essentially I would like the two sheets to do the same exact thing and look identical besides the compressor name, brand, and location. I created a new button and 3 new check boxes for the second sheet but the rest of the sheet is just copied and pasted from the original sheet.

    When I went to write the macro code for the button, I simply duplicated the existing code from the original button. When I enter data onto the second sheet and click the new "Log Data" button, I get a message about a run-time error in the code for the new button. I posted the run-time error below as well as an example of the workbook. Ideally I would like to have up to 14 different compressors, each with their own sheet, in the same workbook, that all do the same thing as the original compressor sheet.

    The message pops up and says:
    Run-Time Error '1004':
    Method "Range" of object "_Global" failed

    When I hit "Debug" the following line of code is highlighted and I'm not sure what I need to do to fix it:

    Please Login or Register  to view this content.
    I believe it has something to do with the Range("J1048576") being sepcific to the sheet of the original button.
    Attached Files Attached Files
    Vergewaltiger
    Excel Novice

+ 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. Hiding rows based on a user input box
    By jshaw82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2013, 06:34 PM
  2. Retain the state of an inputbox's default input for successive runs
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2011, 10:02 AM
  3. Delete rows based on user input
    By Militia in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-10-2009, 06:33 AM
  4. Adding rows depending on user input
    By haitham1984 in forum Excel General
    Replies: 0
    Last Post: 11-10-2008, 07:30 AM
  5. Adding Rows depending on user input
    By haitham1984 in forum Excel General
    Replies: 0
    Last Post: 11-09-2008, 02:35 AM

Tags for this Thread

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