既存のデータのIDを別のブックのデータから検索しステータスを上げる
Private Sub CommandButton5_Click() '進捗登録計上
Dim C As String
C = Left(Sheets("メイン").Range("G4"), 1)
If C = "T" Then
MsgBox "管理Noをダブルクリックしてください。"
Else
DBへ進捗登録
MsgBox "「計上」登録完了"
End If
End Sub
Public Const TOROKU As String = "D:\01_HEV管理Dドライブ用\0_dataDB\1_登録データ\"
Public Const DB = TOROKU & "HEVdata.xlsm" '一点集中
Dim i As Long
Dim wb_A As Workbook 'このbook
Dim wb_B As Workbook '保存先
Dim wb_B_DB As Worksheet '受付データ
Dim wb_B_SIN As Worksheet '進捗
Dim KNo As String
Dim Rng As Range
Sub DBへ進捗登録()
高速開始
KNo = Sheets("メイン").Range("G4").Value
Set wb_B = Workbooks.Open(DB)
Set wb_B_SIN = wb_B.Worksheets("進捗")
Set wb_B_DB = wb_B.Worksheets("データ")
Set wb_B = Workbooks.Open(DB)
Set Rng = wb_B_SIN.Range("A:A").Find(KNo)
If Rng Is Nothing Then
MsgBox "この管理Noはありません。"
wb_B.Close
Else
'★進捗登録する
Dim AR As Long
AR = wb_B_SIN.Range("A:A").Find(KNo).Row
With wb_B_SIN
.Range("M" & AR) = "計上済"
End With
wb_B.Save
wb_B.Close
End If
高速終了
End Sub
Sub DBへ完了進捗登録()
高速開始
KNo = Sheets("メイン").Range("G4").Value
Set wb_B = Workbooks.Open(DB)
Set wb_B_SIN = wb_B.Worksheets("進捗")
Set wb_B_DB = wb_B.Worksheets("データ")
Set wb_B = Workbooks.Open(DB)
Set Rng = wb_B_SIN.Range("A:A").Find(KNo)
If Rng Is Nothing Then
MsgBox "この管理Noはありません。"
wb_B.Close
Else
'★進捗登録する
Dim AR As Long
AR = wb_B_SIN.Range("A:A").Find(KNo).Row
With wb_B_SIN
.Range("M" & AR) = "完了"
End With
wb_B.Save
wb_B.Close
End If
高速終了
End Sub