LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default saving information entered onto forms

With both workbooks open, maybe this'll work:

Option Explicit
Sub testme01()

Dim toWks As Worksheet
Dim formWks As Worksheet
Dim NextRow As Long
Dim iCtr As Long
Dim beforeAddress As Variant
Dim afterCol As Variant

Set formWks = Workbooks("book1.xls").Worksheets("form")
Set toWks = Workbooks("book2.xls").Worksheets("HistoryLog")

beforeAddress = Array("C6", "C7", "C8", "d9", "f10", "g11", "h12", "j13")
afterCol = Array("c", "d", "e", "f", "g", "h", "i", "j")

If UBound(afterCol) < UBound(beforeAddress) Then
MsgBox "Error in before layout!"
Exit Sub
End If

With toWks
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1

With .Cells(NextRow, "A")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With

.Cells(NextRow, "B").Value = Application.UserName

For iCtr = LBound(beforeAddress) To UBound(beforeAddress)
'move 'em in
.Cells(NextRow, afterCol(iCtr)).Value _
= formWks.Range(beforeAddress(iCtr)).Value
formWks.Range(beforeAddress(iCtr)).ClearContents
Next iCtr
End With

End Sub



Adjust the names of the workbooks & worksheets.

And fix the cells that get copied over and the columns that they get saved into.




Frances wrote:

I have been asked how to save data entered into a form on
an Excel worksheet into another workbook and to clear the
form ready for re-use. Does anyone have any
recommendations on the best way to do this. I only have
Excel to work with. Many thanks for any help!


--

Dave Peterson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i fill in information once and use it for several forms J. Nyerere Excel Discussion (Misc queries) 2 December 10th 07 04:32 PM
Slow saving when adding VBA forms [email protected] Excel Discussion (Misc queries) 2 October 11th 06 10:44 AM
Forms, Dropdowns, and Automated Information LittlePalms Excel Discussion (Misc queries) 2 January 5th 06 03:31 AM
saving and loading contents of user forms bennyob Excel Discussion (Misc queries) 0 November 7th 05 02:05 PM
Clearing entered information Ducatisto Excel Discussion (Misc queries) 4 September 6th 05 10:11 AM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"