エクセル2010でマクロが動きません
こんにちは。
マクロ超初心者です。
頑張ってエクセル2016でマクロ作成しましたが、エクセル2010で途中から動かず…。
何が悪いんでしょうか…
ここから動きません…と書いたところから動きません(涙)
Private Sub シート編集_Click()
Application.ScreenUpdating = False
Dim i
Dim Sh1 As Worksheet
Dim Sh2 As Worksheet
Dim Sh4 As Worksheet
Set Sh1 = Worksheets("あ")
Set Sh2 = Worksheets("い")
Set Sh4 = Worksheets("う")
Dim dayCutoff As Date
dayCutoff = Application.InputBox("年月日を入力してください", "お支払期限
年月日を入力", Format(Date, "yyyy/mm/dd"))
Sh4.Range("D12").Value = DateSerial(Year(dayCutoff), Month(dayCutoff) +
2, 0) 'お支払期限
dayCutoff = Application.InputBox("年月日を入力してください", "請求書発行
日を入力", Format(Date, "yyyy/mm/dd"))
Sh4.Range("AC3").Value = Format(Date, "yyyy/mm/dd") '発行日
Sh1.Cells.Clear
With Sh1 'edit
.Range("A2") = "番号"
.Range("B2") = "会社名"
.Range("C2") = "判定"
.Range("D2") = "契約番号"
.Range("E2") = "拠点"
.Range("F2") = "税率"
.Range("G2") = "月額(税抜)"
.Range("H2") = "消費税"
.Range("I2") = "月額(税込)"
.Range("J2") = "今回"
.Range("K2") = "全回"
.Range("L2") = "店番"
ここから動きません…………
For i = 3 To Sh2.Cells(.Rows.Count, 1).End(xlUp).Row
.Cells(i, 1) = Sh2.Cells(i, 2)
.Cells(i, 2) = Sh2.Cells(i, 4)
.Cells(i, 4) = Sh2.Cells(i, 3)
.Cells(i, 5) = Sh2.Cells(i, 4) & "(" & Sh2.Cells(i, 6) &
")"
.Cells(i, 6) = Sh2.Cells(i, 9) & "%課税"
.Cells(i, 7) = Sh2.Cells(i, 8)
.Cells(i, 8) = Sh2.Cells(i, 10)
.Cells(i, 9) = Sh2.Cells(i, 11)
.Cells(i, 10) = Sh2.Cells(i, 12)
.Cells(i, 11) = Sh2.Cells(i, 7)
.Cells(i, 12) = Sh2.Cells(i, 2)
If Sh1.Cells(i, 10) > Sh1.Cells(i, 11) Then
.Cells(i, 3) = "×"
Else
.Cells(i, 3) = "〇"
End If
If Sh1.Cells(i, 3) = "×" Then
.Cells(i, 2) = ""
End If
Next i
End With
'空白行を削除
Dim j As Integer, myFlag As Boolean
Dim c As Range
With Worksheets("edit").Range("A2").CurrentRegion
For j = .Rows.Count To 2 Step -1
myFlag = False
For Each c In .Cells(j, 2)
If c.Value <> "" Then
myFlag = True
Exit For
End If
Next
If myFlag = False Then
.Rows(j).Delete
End If
Next
End With
MsgBox "データの転記が終わりました"
End Sub
お礼
まことにありがとうございます。