Dim sheetname As String

Private Sub ScrollBar1_Change()

End Sub

Private Sub ComboBox1_Change()

End Sub

Private Sub CommandButton1_Click()
 
End Sub

Private Sub CommandButton3_Click()

End Sub

Private Sub aboutbutton_Click()

End Sub

Private Sub exitbutton_Click()
    Unload mainform
    End
End Sub

Private Sub InputButton_Click()
       Call InputData(sheetname)
     Call InputData("月統計表")
      Call cleartext
      mainform.TextBox1.SetFocus
End Sub

Private Sub Label6_Click()

End Sub

Private Sub ListBox1_Click()
    Dim listpos As Integer
    
    listpos = mainform.ListBox1.ListIndex
    Select Case listpos
        Case 0
            sheetname = "秋葉原商店"
        Case 1
            sheetname = "紀伊國屋書店"
    End Select
    Worksheets(sheetname).Activate
    mainform.TextBox1.SetFocus
    
End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
With mainform.ListBox1
    .AddItem "秋葉原商店"
    .AddItem "紀伊國屋書店"
    .Selected(0) = True
End With
Worksheets("秋葉原商店").Activate
End Sub

Private Sub InputData(ByVal sname As String)
    Dim rowpos As Integer
    Dim colpos As Integer
    
    rowpos = 2
    colpos = 2
    
    Do
    
        rowpos = rowpos + 1
        celdata = Worksheets(sname).Cells(rowpos, colpos)
    Loop While celdata <> ""
    
    With Worksheets(sname)
         .Cells(rowpos, colpos) = TextBox1.Text
         .Cells(rowpos, colpos + 1) = TextBox2.Text
         .Cells(rowpos, colpos + 2) = TextBox3.Text
         .Cells(rowpos, colpos + 3) = TextBox4.Text
         .Cells(rowpos, colpos + 4) = TextBox5.Text
    
    End With
    
    If sname = "月統計表" Then
        Worksheets(sname).Cells(rowpos, 1) = ActiveSheet.Name
    End If
End Sub

Private Sub cleartext()
    With mainform
        .TextBox1.Text = ""
        .TextBox2.Text = ""
        .TextBox3.Text = ""
        .TextBox4.Text = ""
        .TextBox5.Text = ""
    End With
    
End Sub

Private Sub UserForm_Terminate()
    ActiveWorkbook.Save
    
End Sub

    Source: geocities.com/hk/bokuwa_dikikodesu/school-mark

               ( geocities.com/hk/bokuwa_dikikodesu)                   ( geocities.com/hk)