0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel方眼で入力画面を作成する(改)

0
Last updated at Posted at 2020-01-10

これも以前投稿したExcel方眼で入力画面を作成するを少しマシにして、範囲指定ができるようになりました。

Sub DGET(M, R1N, R2N)
    N = Range(R1N).Columns.Count
    
    Set R1 = Range(R1N).Offset(M - 1).Resize(1, N)

    Range(R2N).Resize(N, 1) = WorksheetFunction.Transpose(R1)

End Sub

Sub DSET(M, R1N, R2N)
    N = Range(R1N).Columns.Count
    
    For I = 1 To N
        Range(R1N).Offset(M - 1, I - 1).Resize(1, 1) = IFZS(Range(R2N).Offset(I - 1, 0).Resize(1, 1).Value)
    Next I
End Sub

Sub LOAD()
    If Not (ActiveSheet.Name Like "情報入力") Then Exit Sub

    I = IFSZ(Range("JI_[KJ]").Value)
    
    If I = 0 Then Exit Sub
    
    Call START_MANUAL
    
    Call DGET(I, "KJ_[製品名]", "K2")
    Call DGET(I, "KJ_[材料]", "Z2")
    
    Call DGET(I, "KJ_[[D]:[R]]", "F4")
    Call DGET(I, "KJ_[[01]:[38]]", "L4")
    Call DGET(I, "KJ_[[項目1]:[項目7]]", "C17")
    Call DGET(I, "KJ_[[基準1]:[基準7]]", "F17")
    
    Call DGET(I, "KJ_[[秒]:[在庫]]", "AA4")
    Call DGET(I, "KJ_[備考]", "AA13")
    
    Call START_AUTO
End Sub

Sub SAVE()
    If Not (ActiveSheet.Name Like "情報入力") Then Exit Sub

    I = IFSZ(Range("JI_[KJ]").Value)
    If I = 0 Then Exit Sub
    
    Call START_MANUAL
         
    Call DSET(I, "KJ_[製品名]", "K2")
    Call DSET(I, "KJ_[材料]", "Z2")
        
    Call DSET(I, "KJ_[[D]:[R]]", "F4")
    Call DSET(I, "KJ_[[01]:[38]]", "L4")
    Call DSET(I, "KJ_[[項目1]:[項目7]]", "C17")
    Call DSET(I, "KJ_[[基準1]:[基準7]]", "F17")

    Call DSET(I, "KJ_[[秒]:[繰越]]", "AA4")
    Call DSET(I, "KJ_[備考]", "AA13")
 
    Call START_AUTO
End Sub
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?