Excel 2010, the ability to save data from a excel form to differet worksheets
Hello,
I created a data entry form in excel 2010 and for most part it works. Next, I like to be able to select which worksheet to save the data perhaps by incorporating couple of check box to indicate which sheet to save the data to.
example
check box for building1 and building2
the worksheets all have similar format and collect the same information.
if building2 is selected save content of the entry form in sheet labeled building2 etc
any help you can provide would be greatly apprediated.
thanks.
what i have so far(excel 2010
PHP Code:
Private Sub btn_append_Click()
Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Assessment")
'find first empty row in database iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a part number If Trim(Me.txt_roomNumber.Value) = "" Then Me.txt_roomNumber.SetFocus MsgBox "Please enter a Room Number" Exit Sub End If
'copy the data to the database 'use protect and unprotect lines, ' with your password ' if worksheet is protected With ws ' .Unprotect Password:="password" .Cells(iRow, 1).Value = Me.txt_roomNumber.Value .Cells(iRow, 2).Value = Me.txt_roomName.Value .Cells(iRow, 3).Value = Me.txt_department.Value .Cells(iRow, 4).Value = Me.txt_contact.Value .Cells(iRow, 5).Value = Me.txt_altContact.Value .Cells(iRow, 6).Value = Me.cbx_devices.Value .Cells(iRow, 7).Value = Me.cbx_wallWow.Value .Cells(iRow, 8).Value = Me.txt_existingHostName.Value .Cells(iRow, 10).Value = Me.cbx_relocate.Value If Me.ckb_powerbar.Value = True Then Cells(iRow, 11).Value = "Y" If Me.ckb_dataJackPull.Value = True Then Cells(iRow, 12).Value = "P" .Cells(iRow, 13).Value = Me.txt_existingDataJack.Value If Me.ckb_hydroPull.Value = True Then Cells(iRow, 14).Value = "P" Else Cells(iRow, 14).Value = "A" .Cells(iRow, 19).Value = Me.txt_cablePullDesc.Value .Cells(iRow, 20).Value = Me.txt_hydroPullDesc.Value .Cells(iRow, 21).Value = Me.Txt_otherDesc.Value ' .Protect Password:="password" End With
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True MsgBox "Please use the Close Form button!" End If End Sub
Bookmarks