+ Reply to Thread
Results 1 to 2 of 2

Useform clear contents after saving into spreadsheet

Hybrid View

Gordonhk Useform clear contents after... 08-01-2013, 05:10 AM
:) Sixthsense :) Re: Useform clear contents... 08-01-2013, 05:13 AM
  1. #1
    Registered User
    Join Date
    07-26-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    15

    Useform clear contents after saving into spreadsheet

    Hi everyone,

    I am building a reporting tool for students and I managed to saved the data which is inputted into a userform to anexcel spreadsheet. When a student click the submit button (CommandButton1) I want all contents in the useform to be cleared so another student can fill in the form with a new Project ID. This is the code I used so far:

    Private Sub CommandButton1_Click()
    
    Dim NextFreeRow As Long
    NextFreeRow = Range("a65536").End(xlUp).Row + 1
    
    Cells(NextFreeRow, 1) = ProjectID.Value
    Cells(NextFreeRow, 2) = TextBox9.Text
    Cells(NextFreeRow, 3) = Creator.Text
    Cells(NextFreeRow, 4) = TextBox35.Text
    Cells(NextFreeRow, 5) = TextBox66.Text
    Cells(NextFreeRow, 6) = ComboBox6.Value
    Cells(NextFreeRow, 7) = ComboBox8.Value
    Cells(NextFreeRow, 8) = TextBox18.Text
    Cells(NextFreeRow, 9) = TextBox38.Text
    Cells(NextFreeRow, 10) = Title.Text
    Cells(NextFreeRow, 11) = TextBox7.Text
    Cells(NextFreeRow, 12) = TextBox65.Text
    Cells(NextFreeRow, 13) = CheckBox1.Value
    Cells(NextFreeRow, 14) = TextBox39.Text
    Cells(NextFreeRow, 15) = TextBox4.Text
    Cells(NextFreeRow, 16) = TextBox36.Text
    Cells(NextFreeRow, 17) = ComboBox3.Text
    Cells(NextFreeRow, 18) = TextBox12.Text
    Cells(NextFreeRow, 19) = TextBox20.Text
    Cells(NextFreeRow, 20) = TextBox19.Text
    
    
    Exit Sub
    Can anyone provide me with the code 1. clear contents after submission 2. generate a new project ID after submission and It would be also helpful to specify the Worksheet I am saving the data in to.

    Thanks

    Gordon
    Last edited by Gordonhk; 08-01-2013 at 05:16 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Useform clear contents after saving into spreadsheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

+ 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. Clear contents of empty copied range before saving file as CSV
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2013, 04:29 PM
  2. [SOLVED] Clear contents based on contents of another cell
    By Katrina DTE in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2013, 02:44 PM
  3. [SOLVED] Copy/Paste & Clear Contents Macro on multiple spreadsheet
    By greggatz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-01-2012, 10:16 AM
  4. Copy list contents down, then clear contents
    By hektisk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2011, 04:34 PM
  5. Clear sheet contents but retain Clipboard contents
    By nebb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2007, 01:42 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