+ Reply to Thread
Results 1 to 21 of 21

How to create a form that logs data?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-27-2008
    Location
    Orange County, CA
    Posts
    8

    Question How to create a form that logs data?

    I would like to make a form where a user can fill in information in an easy to ready format, then click a submit button, and have the data moved to another sheet or file from where the data can be merged into another document. Each time the user fills out the information and clicks submit, a new line of the data is created in the destination. Here's a picture to show what I'd like to do:

    \1

    Any help would be great. Thanks!

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Try this.

    Sub bbb()
      Dim OutSH As Worksheet
      Set OutSH = Sheets("Sheet2")
      
      outrow = OutSH.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
      
      OutSH.Cells(outrow, 1).Value = OutSH.Cells(outrow - 1, 1).Value + 1
      OutSH.Cells(outrow, 2).Value = Range("C3").Value
      OutSH.Cells(outrow, 3).Value = Range("C4").Value
      OutSH.Cells(outrow, 4).Value = Range("C5").Value
    End Sub
    rylo

  3. #3
    Registered User
    Join Date
    06-27-2008
    Location
    Orange County, CA
    Posts
    8
    Thank you for that. I may be in over my head here, but where would I apply that code? To the button? Would that constitute the macro?

    I created the simplified picture to visually explain what I'm trying to do, but perhaps it would be helpful if I just attached the file that I'm actually working on. I put a button in there, but wasn't really sure what to do with it.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Don't have excel 2007 on this machine so can you please save the file in 2003 format.

    rylo

  5. #5
    Registered User
    Join Date
    06-27-2008
    Location
    Orange County, CA
    Posts
    8
    Here's the same file in 2003 format.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    When in excel, hold down the alt key, and press F11. This will open the VBE. Now go Insert, Module and paste the code into the module. Now go back to the spreadsheet, hold down the ctrl key, right click on the button, select assign macro, select the macro bbb. It will now run when you press the button.

    However, the macro was built for your post example, and won't do anything much for your working example. Can you advise where the data on Form is meant to be posted on Database? That way we can set up the code to transfer the data to the right cells.

    ryl

+ 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