+ Reply to Thread
Results 1 to 5 of 5

Copy textbox data to a specific cell, based on date

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Copy textbox data to a specific cell, based on date

    I am creating a Userform for an inventory management system, and I can't seem to figure out how to copy my data exactly where I want it in my workbook.

    I am using Sheet2.jpg to collect raw material data, which I would like organized by date in my workbook Sheet1.jpg.

    Say the date is today, 03/06/2012: I would like the "Quantity" to be copied to cell L11 in the worksheet titled "Title" to correspond with the date.

    Basically, I'd like VBA to do something to the effect of: If Date = "xx/xx/xxxx" Then Copy Data from TextBoxQuantity to Cell "XX" in workbook "Title".

    I'm sorry if I am not wording things properly, VBA is not my area of expertise. Actually, programming of any kind whatsoever is not my expertise. I seriously appreciate any assistance in this matter.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Simple VBA coding help? Copy textbox data to a specific cell, based on date

    Hello themikeford,

    Welcome to the Forum!

    The macro code below is for "TextBox1" and "TextBox2". I used these as default names because I don't know what you named your TextBoxes. Copy the code from the Dim statement to the line before the End Sub and paste this into the AfterUpdate procedure for your text box where the date is entered. Change "TextBox2" in the macro to match the name of the"Quantity In" text box.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 03-06-2012 at 02:04 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Simple VBA coding help? Copy textbox data to a specific cell, based on date

    Hi Leith Ross,
    I like your code. It's always instructing and inspiring. But here, why bother calculating R = FindDate.Row as it will always be 2.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Simple VBA coding help? Copy textbox data to a specific cell, based on date

    Hello p24leclerc,

    You are correct. I could have simply used 2. It is an automatic habit I have of making the code more flexible. If the user should decide to make a change later on, I don't have to make as many alterations to the code.

  5. #5
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Copy textbox data to a specific cell, based on date

    Thank you for the speedy response, and my apologies for the delay in responding. I haven't had a chance to work the bugs out of the code and get it implemented into my particular project, but my hopes are high! Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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