Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Excel User Form that submits to a network workbook
  2. Private Sub CommandButton1_Click()
  3.  
  4. On Error GoTo 1
  5.  
  6. Dim nwb As Workbook
  7.  
  8. Set nwb = Workbooks.Open("N:GeneralFORMSNew_FORM.xls")
  9.  
  10.  
  11. Set ws = Worksheets("FORM Data")
  12.  
  13. iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
  14.     SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
  15.  
  16.  
  17.  
  18.  
  19. ws.Cells(iRow, 1).Value = Me.TextBox1.Value
  20. ws.Cells(iRow, 2).Value = Me.TextBox2.Value
  21. ws.Cells(iRow, 3).Value = Me.ComboBox1.Value
  22. ws.Cells(iRow, 4).Value = Me.ComboBox2.Value
  23. ws.Cells(iRow, 5).Value = Me.ComboBox6.Value
  24. ws.Cells(iRow, 6).Value = Me.TextBox3.Value
  25. ws.Cells(iRow, 7).Value = Me.TextBox4.Value
  26. ws.Cells(iRow, 8).Value = Me.ComboBox4.Value
  27. ws.Cells(iRow, 9).Value = Me.ComboBox5.Value
  28. ws.Cells(iRow, 10).Value = Me.TextBox5.Value
  29.  
  30. 'With nwb.Sheets(1)
  31.     '.Range("A1").Value = Me.TextBox1.Value
  32.     '.Range("B1").Value = Me.TextBox2.Value
  33.     '.Range("C1").Value = Me.ComboBox1.Value
  34. 'End With
  35.  
  36. nwb.Close True
  37.  
  38. End Sub