|
またまた超初心者のきしやんです。
ユーザーフォームに時刻のリストボックスがあり
下記のコードでListBox1にNullがはいってしまいます。
Option Explicit
Dim stjikoku As Date, hizuke As Date, hizuke1 As Date
Dim st1 As Integer, st2 As Integer, st3 As Integer, st4 As Integer, mybtn As Integer
Dim sp1 As Integer, sp2 As Integer, sp3 As Integer, sp4 As Integer, rolly As Integer
Dim paper As Integer, fulecon As Integer
Dim seisanryou As Integer, tounyuryou As Integer, zaikoryou As Integer
Dim mymsg As String, mytitle As String, grade As String, grade1 As String, grade2 As String, mylbl As String
Dim jikan As Single
Private Sub CommandButton1_Click()
CommandButton1.Visible = False
Worksheets("sheet3").Select
Range("d9").Select
mytitle = "キャンペーン確認"
hizuke = Worksheets("sheet4").Range("c4")
hizuke1 = Worksheets("sheet4").Range("c5")
grade = Worksheets("sheet1").Range("t18")
mymsg = hizuke & "〜" & hizuke1 & "のキャンペーンは" & Chr(13) _
& grade & "です"
mybtn = MsgBox(mymsg, vbOKOnly + vbInformation, mytitle)
inputboxdata100:
hizuke = Worksheets("sheet4").Range("c4")
mymsg = hizuke & "の生産量を入力して下さい"
mytitle = "生産量入力"
seisanryou = Application.InputBox(prompt:=mymsg, Title:=mytitle, Type:=1)
Worksheets("sheet6").Range("c5").Value = seisanryou
mytitle = "生産量"
mymsg = hizuke & "〜" & hizuke1 & "の生産量は" & Chr(13) & seisanryou & "tですね?"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
If mybtn = vbNo Then
GoTo inputboxdata100
End If
inputboxdata101:
hizuke = Worksheets("sheet4").Range("c4")
mymsg = hizuke & "のNo.1サイロの在庫量を入力して下さい"
mytitle = "在庫量入力"
zaikoryou = Application.InputBox(prompt:=mymsg, Title:=mytitle, Type:=1)
Worksheets("sheet3").Range("d4").Value = zaikoryou
mytitle = "在庫量"
mymsg = hizuke & "のNo.1サイロの在庫量は" & Chr(13) & zaikoryou & "tですね?"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
If mybtn = vbNo Then
GoTo inputboxdata101
End If
inputboxdata102:
hizuke = Worksheets("sheet4").Range("c4")
mymsg = hizuke & "のNo.2サイロの在庫量を入力して下さい"
mytitle = "在庫量入力"
zaikoryou = Application.InputBox(prompt:=mymsg, Title:=mytitle, Type:=1)
Worksheets("sheet3").Range("d13").Value = zaikoryou
mytitle = "在庫量"
mymsg = hizuke & "のNo.2サイロの在庫量は" & Chr(13) & zaikoryou & "tですね?"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
If mybtn = vbNo Then
GoTo inputboxdata102
End If
inputboxdata103:
hizuke = Worksheets("sheet4").Range("c4")
mymsg = hizuke & "のNo.17サイロの在庫量を入力して下さい"
mytitle = "在庫量入力"
zaikoryou = Application.InputBox(prompt:=mymsg, Title:=mytitle, Type:=1)
Worksheets("sheet3").Range("d22").Value = zaikoryou
mytitle = "在庫量"
mymsg = hizuke & "のNo.17サイロの在庫量は" & Chr(13) & zaikoryou & "tですね?"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
If mybtn = vbNo Then
GoTo inputboxdata103
Else
Worksheets("sheet3").Select
Range("d9").Select
grade1 = "TH-700BJ"
grade2 = Worksheets("sheet1").Range("t18")
If StrComp(grade1, grade2, vbTextCompare) = 0 Then
Call CommandButton2_Click
Else
Exit Sub
End If
End If
End Sub
'****************************************************************
'TH-700BJの場合のサイロ投入'
'****************************************************************
Private Sub CommandButton2_Click()
mymsg = "No.1サイロの投入時刻をリストボックスより選択して下さい"
mytitle = "投入時刻"
mybtn = MsgBox(mymsg, vbOKOnly + vbInformation, mytitle)
stjikoku = ListBox1 ・・・・・・・・・・・ ここにNullが入ってしまいます。
mymsg = "No.1サイロの投入時刻は" & stjikoku & "ですね"
mytitle = "投入時刻"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
Worksheets("sheet3").Range("d9").Value = stjikoku
If mybtn = vbNo Then
Exit Sub
End If
mymsg = "No.1サイロの投入時間をリストボックスより選択して下さい"
mytitle = "投入時刻"
mybtn = MsgBox(mymsg, vbOKOnly + vbInformation, mytitle)
End Sub
Private Sub CommandButton4_Click()
jikan = ListBox2
Worksheets("sheet3").Range("d10").Value = jikan
mymsg = "No.1サイロの投入時間は" & jikan & "時間ですね"
mytitle = "投入時間"
mybtn = MsgBox(mymsg, vbYesNo + vbQuestion, mytitle)
If mybtn = vbNo Then
Exit Sub
End If
End Sub
どうか宜しくお願いします。
|
|