Sub Doitbyhand()
Application.EnableEvents = Not Application.EnableEvents
End Sub
Sub LoadData(Row As Long)
For i = 1 To FieldNum
dataarray(i) = Cells(Row, i)
'MsgBox dataarray(i)
Next
End Sub
Sub WriteDataback(TargetSheet As String, Optional changecode As Boolean)
If Not changecode Then
selectlastemptyrow (TargetSheet)
Else
Sheets(TargetSheet).Select
End If
For i = 1 To FieldNum
ActiveCell.Offset(0, i - 1).Value = dataarray(i)
Next
End Sub
Sub selectlastemptyrow(TargetSheet As String)
Sheets(TargetSheet).Select
Cells(65536, 1).Select
Selection.End(xlUp).Offset(1, 0).Select
End Sub
Sub DeleteRecord(TargetSheet As String, Row As Long, Optional besure As Boolean)
Sheets(TargetSheet).Select
If Not besure Then
Range(Cells(Row, 1), Cells(Row, FieldNum)).Delete shift:=xlUp
ElseIf IsEmpty(Cells(Row, 1)) Then Range(Cells(Row, 1), Cells(Row, FieldNum)).Delete shift:=xlUp
End If
End Sub
Sub getData(TargetSheet As String, codeValue As Variant)
Dim i As Integer
If Not IsEmpty(codeValue) Then
Sheets(TargetSheet).Select
Cells(1, 1).Select
Cells.Find(What:=codeValue, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
For i = 1 To FieldNum
dataarray(i) = Cells(ActiveCell.Row, i)
Next
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, FieldNum)).Delete shift:=xlUp
End If
End Sub