+ Reply to Thread
Results 1 to 10 of 10

UserForm not entering data in to spreadsheet

  1. #1
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    UserForm not entering data in to spreadsheet

    First off let me state that before this spreadsheet, I never used Macros whatsoever, so I’m completely new to it. I did use the “New to Excel” Sticky and a knowledgeable friend to get where I am now but have reached an impasse as to the why.

    My first question is how do I change the coding to stop the following Visual Basic error when I click add – “Run-time error ‘1004’: The cell or chart that you are trying to change is protected and therefore read-only…”? I created a Macro that unlocks all affected sheets as a temporary workaround, but this UserForm will be for everyone to use where I work and I don’t want them using it.

    My second question is how do I get the UserForm to actually enter data? I can use the form, but it doesn’t actually enter any data into my table (a little frustrating).

    I’ve cut down everything to the objects, macros and sheets in question and attached it. Any help would be greatly appreciated at this point. Thank you all in advance.

    UserThermalsForm.xlsm

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: UserForm not entering data in to spreadsheet

    In order to enter the data into your database, you can use me.textboxname.text instead of .value.

    And for the run time error, instead of protecting the sheet, try to hide the sheet and use protect workbook option. The users cannot unhide the worksheet, when the workbook is protected.

  3. #3
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: UserForm not entering data in to spreadsheet

    The "me.textboxname.text" instead of .value didn't work . As far as unprotecting the worksheet so as to enter data, I changed a couple lines of code in the opening of the user form and the close button on the form. I did find that by default the workbook can't be manipulated with the Userform window open, so nothing to change/protect there. I need for anybody to look at the table at any time, a coworker suggested eventually making it searchable, to which I said one headache at a time .

    Please Login or Register  to view this content.
    I added/modified/pasted this at the end of the Userform code

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: UserForm not entering data in to spreadsheet

    I just alt-end the data table and found that the data IS being entered after line 365, but it's not being entered into the correct area on the data table.
    Last edited by LoneWolf3574; 09-28-2012 at 08:51 PM. Reason: Incorrect final solution

  5. #5
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: UserForm not entering data in to spreadsheet

    Hi,
    Do you still have trouble in your code? Your new code seems to be working.

    Regards,
    Sindhu

  6. #6
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: UserForm not entering data in to spreadsheet

    The only thing I'm still having an issue with is the data table, the Userform works, but it starts with line 365, which is not where my data starts. The only thing I can think of at the moment is to create two more text boxes with the date and time. That may be better in the long run if somebody gets confused or forgets to make the data entries for the day, then we would know which is missing. I still would have the same issue as I have a vlookup function related to the data table, making the first "empty" data row still 365 right now.

  7. #7
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: UserForm not entering data in to spreadsheet

    If you want to find last used row in A column, you can try Range("A65536").End(xlup).row

  8. #8
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: UserForm not entering data in to spreadsheet

    Quote Originally Posted by Sindhus View Post
    If you want to find last used row in A column, you can try Range("A65536").End(xlup).row
    I just now tried that changing to B column and get a "Compile error: Invalid use of property" with the ".Row" highlighted in debug. It's progress, better than the other results I've been getting .

    I've also the following, but neither worked

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I've included an attachment of the progress so far.

    UserThermalsForm.xlsm
    Last edited by LoneWolf3574; 09-29-2012 at 04:38 AM. Reason: Wrong attachement

  9. #9
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: UserForm not entering data in to spreadsheet

    It should be
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: UserForm not entering data in to spreadsheet

    That did the trick, just added a " + 1" to the end, otherwise it overwrites the last line in the table. Now I've got other problems to work on and other questions to ask. Thank you ever so much for your help, I really do appreciate it.
    Last edited by LoneWolf3574; 10-02-2012 at 01:13 AM. Reason: typo

+ 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