If WorksheetFunction.CountIf(Worksheets("商品マスタ").Columns(Range("SM管理番号").Column), Me.lbl管理番号) > 0 Then Dim msg As String, title As String msg = "その商品IDは既に登録されています。" & vbCrLf & "修正してもよろしいですか?" title = "確認" Dim res As Integer res = MsgBox(msg, vbYesNo + vbInformation, title) If res = vbNo Then Exit Sub
MsgBox "登録しました。" Call cmdクリア_Click ' Unload Me End Sub
Private Sub lstデータリスト_Click() With lstデータリスト lbl管理番号.Caption = .List(.ListIndex, 0) txt商品名.Text = .List(.ListIndex, 1) txt規格.Text = .List(.ListIndex, 2) txt定価.Text = .List(.ListIndex, 3) End With End Sub