创建一个复选框。复制文本框

时间:2015-06-23 17:55:04

标签: excel vba excel-vba concatenation userform

如何设置复选框。他从上到下自动Coppy

复制数据

我也了解网络以及VBA Excel UserForm

我的问题是,如果它是chekbox,将上面七个文本框中的数据复制到七个文本框中,((并将其保存在excel中)。)

image from user

     Private Sub cmdAdd_Click()
      Dim iRow As Long
      Dim ws As Worksheet
      Set ws = Worksheets("Tabelle1")



      '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.txtHane.Value) = "" Then
        Me.txtHane.SetFocus
        MsgBox "Ju lutem shkruani nje Orar të punës"
        Exit Sub
      End If


      With ws
      '  
        .Cells(iRow, 1).Value = Me.txtHane.Value
        .Cells(iRow, 2).Value = Me.txtMarte.Value
        .Cells(iRow, 3).Value = Me.txtMerkure.Value
        .Cells(iRow, 4).Value = Me.txtEnjte.Value
        .Cells(iRow, 5).Value = Me.txtPremte.Value
        .Cells(iRow, 6).Value = Me.txtShtune.Value
        .Cells(iRow, 7).Value = Me.txtDjele.Value
        .Cells(iRow, 8).Value = Me.cmbRajoni.Value
        .Cells(iRow, 9).Value = Me.txtRruga.Value


      End With

      'clear the data
      Me.txtHane.Value = ""
      Me.txtMarte.Value = ""
      Me.txtMerkure.Value = ""
      Me.txtEnjte.Value = ""
      Me.txtPremte.Value = ""
      Me.txtShtune.Value = ""
      Me.txtDjele.Value = ""
      Me.txtRruga.Value = ""
      Me.txtHane.SetFocus

0 个答案:

没有答案