+ Reply to Thread
Results 1 to 20 of 20

Help Posting to Active Sheet

  1. #1
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Question Help Posting to Active Sheet

    Ok so this may be an easy one for you pros!
    I am try to figure out how to get a userform to post data to an active sheet. The problem is the userform doesn't know what the active sheet is until it is activated by the previous form.
    So when the user is presented with the original userform it asls which task they would like to perform. One of these is to add a medication for a client. They click on the button and get an inputbox to scan the client ID # and it opens their worksheet and the userform that has a series of text boxes and a "submit" button. I'm trying to get the values from those textboxes to specific rows/columns on the current active sheet.
    I saw this in another thread that I may try:
    Please Login or Register  to view this content.
    But again, the sheet wouldn't be identified until it is activated by the inputbox.
    WHAT????

  2. #2
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Help Posting to Active Sheet

    So you're saying that this inputbox identifies which sheet you need? You can just Dim a String and set it equal to whatever the user puts in the inputbox.
    ~~LaffyAffy13~~

    If I have helped you solve your problem, please be sure to click at the bottom left of my post.

    Thanks.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    The code you posted will put the data on the active sheet because there's no sheet reference.

    The only problem is that you are looking at Sheet1 to find the next empty row.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    So something like this?
    Please Login or Register  to view this content.
    And I put it at the top of the userform with the values I want on the worksheet?
    Isn't there a way to just tell the userform that "hey this is the active sheet that is open right now. Take what I put in the boxes and put it here."?
    I'm just confused. Sorry.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    If you don't explicitly specify a sheet then something like Cells(erow,4) will refer to a cell on whatever the active sheet is.

    Your code doesn't specify a sheet so the data is going to the active sheet.

    However because you have specified a sheet, Sheet1, for finding erow it might not be going where you expect it to.

  6. #6
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Help Posting to Active Sheet

    I'm still uncertain what you are asking. Norie brings up a good point, but even with that answer I can't identify what you're really asking. As of right now, all of your data is being placed in Sheet2, in columns B-N. They should be placed in the row equivalent to the very last used row in Sheet1. What is your issue?

  7. #7
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    So I can just do away with anything that specifies a a sheet and it should still work?
    How would I handle this line in order to get it to post to the next available row?
    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    Remove the sheet reference Sheet1.

  9. #9
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    I'm sorry for the confusion but you have to forget the Sheet1 and Sheet2 in the above example. I was just saying that this was the code, disregarding the sheet1 and 2, that I was going to try to get the textbox values from the userform to the active sheet.

  10. #10
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    So again, the staff person opens the application and is presented with a choice of tasks to perform.
    One of these is to add a medication to a client's worksheet. They click on the command button and are prompted to scan the client's ID# into an inputbox.
    Based on that # it opens a worksheet and a userform. On that form are various textboxes that ask specific questions about the medication.
    Thats the point that I have gotten too.
    This is the code:
    Please Login or Register  to view this content.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    I don't like repeating myself but that code is posting to the active sheet.

  12. #12
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Help Posting to Active Sheet

    I agree with Norie. I really don't see what your problem is.

  13. #13
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    I'm sorry about that, but I am testing it and it isn't writing to the sheet. Maybe I'm missing it or not seeing it? Man this flips my switch!

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  15. #15
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    OH dang it! It posted it down the page!!!!

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    Eh, isn't that kind of what I said earlier - it won't got where you expect it because you are using a different sheet to find the next empty row.

  17. #17
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    But I never used the original code posted.
    I used this.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Help Posting to Active Sheet

    Do you have data in Column A?

  19. #19
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Help Posting to Active Sheet

    When you originally used that code the data would have gone to the wrong row.

    Because of that the following code would also goto the wrong row.

    For example if that code had put the data on row 334 then any subsequent code would put data under that.

  20. #20
    Registered User
    Join Date
    07-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Help Posting to Active Sheet

    Yeah you're right, I see it.
    I figured out that I had added a copy of the header down below so staff could use it as a reference to tell which column had what and that the form was posting data below that copy of the header. I removed it and it works good now.
    Thanks you guys for being so patient.

+ 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. How to copy the cells from one active sheet to another active sheet
    By pranav.y in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2013, 09:42 AM
  2. Macro to Print active sheet as PDF to Active workbook and customize name
    By Scott Taylor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2012, 08:52 PM
  3. how can worksheet_activate event of active sheet work of active workbook
    By tahir mahmood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2011, 08:19 AM
  4. I need to sort an active sheet using the col of the active cell
    By HamFlyer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2006, 02:30 PM
  5. Copy from active sheet and paste into new sheet using info from cell in active
    By Ingve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 06:00 PM

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