質問編集履歴
3
コードを全て載せました。フォームを添付しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,74 @@
|
|
1
|
+
![このフォームに日付を入れて実行します。](729d4f91d8228f9348e943c50ed1e155.png)
|
2
|
+
|
3
|
+
98と入れると、自動的に9/8になります。
|
4
|
+
|
5
|
+
|
6
|
+
|
1
7
|
```ここに言語を入力
|
8
|
+
|
9
|
+
Private Sub CommandButton1_Click()
|
10
|
+
|
11
|
+
Dim kugiri As String
|
12
|
+
|
13
|
+
Dim mYmm As String
|
14
|
+
|
15
|
+
Dim mYdd As String
|
16
|
+
|
17
|
+
Dim mYmmdd As String
|
18
|
+
|
19
|
+
kugiri = "/"
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
If Len(Me.TextBox1.Text) <> 3 Then
|
24
|
+
|
25
|
+
mYmm = Left(Me.TextBox1.Text, 1)
|
26
|
+
|
27
|
+
mYdd = Right(Me.TextBox1.Text, 1)
|
28
|
+
|
29
|
+
Else
|
30
|
+
|
31
|
+
mYmm = Left(Me.TextBox1.Text, 1)
|
32
|
+
|
33
|
+
mYdd = Right(Me.TextBox1.Text, 2)
|
34
|
+
|
35
|
+
End If
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
mYmmdd = mYmm & kugiri & mYdd
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
Call Backup_start(mYmmdd)
|
44
|
+
|
45
|
+
End Sub
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
Private Sub CommandButton2_Click()
|
50
|
+
|
51
|
+
Unload Me
|
52
|
+
|
53
|
+
End Sub
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
|
58
|
+
|
59
|
+
If KeyAscii < Asc(0) Or KeyAscii > Asc(9) Then
|
60
|
+
|
61
|
+
MsgBox "月日(MMDD)を入力してください"
|
62
|
+
|
63
|
+
KeyAscii = 0
|
64
|
+
|
65
|
+
End If
|
66
|
+
|
67
|
+
End Sub
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
Sub Backup_start(mYmmdd As String)
|
2
72
|
|
3
73
|
Dim myRange1 As Range
|
4
74
|
|
@@ -10,23 +80,15 @@
|
|
10
80
|
|
11
81
|
Dim ws2 As Worksheet
|
12
82
|
|
13
|
-
|
14
|
-
|
15
83
|
Set ws1 = Worksheets("Main")
|
16
84
|
|
17
85
|
Set ws2 = Worksheets("List")
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
86
|
|
23
87
|
MsgBox mYmmdd & "で検索します"
|
24
88
|
|
25
89
|
|
26
90
|
|
27
91
|
For Each myRange1 In ws1.Range("B1:B30000")
|
28
|
-
|
29
|
-
|
30
92
|
|
31
93
|
For Each myRange2 In ws2.Range("F5:F30")
|
32
94
|
|
@@ -40,10 +102,8 @@
|
|
40
102
|
|
41
103
|
Next myRange2
|
42
104
|
|
43
|
-
|
44
|
-
|
45
105
|
Next myRange1
|
46
106
|
|
47
|
-
|
107
|
+
End Sub
|
48
108
|
|
49
109
|
```
|
2
マークダウン記法のタグに入れました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,6 +44,6 @@
|
|
44
44
|
|
45
45
|
Next myRange1
|
46
46
|
|
47
|
-
|
47
|
+
|
48
48
|
|
49
49
|
```
|
1
コードを挿入しなおし
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
+
```ここに言語を入力
|
2
|
+
|
3
|
+
Dim myRange1 As Range
|
4
|
+
|
5
|
+
Dim myRange2 As Range
|
6
|
+
|
7
|
+
Dim sevname As String
|
8
|
+
|
1
|
-
Dim ws1 As Worksheet
|
9
|
+
Dim ws1 As Worksheet
|
2
10
|
|
3
11
|
Dim ws2 As Worksheet
|
4
12
|
|
@@ -8,11 +16,21 @@
|
|
8
16
|
|
9
17
|
Set ws2 = Worksheets("List")
|
10
18
|
|
19
|
+
|
11
20
|
|
21
|
+
|
22
|
+
|
23
|
+
MsgBox mYmmdd & "で検索します"
|
24
|
+
|
25
|
+
|
12
26
|
|
13
27
|
For Each myRange1 In ws1.Range("B1:B30000")
|
14
28
|
|
29
|
+
|
30
|
+
|
15
31
|
For Each myRange2 In ws2.Range("F5:F30")
|
32
|
+
|
33
|
+
|
16
34
|
|
17
35
|
If InStr(myRange1.Value, mYmmdd) <> 0 And myRange1.Offset(0, 1).Value Like myRange2 And myRange1.Offset(0, 6).Value Like "30233" Then
|
18
36
|
|
@@ -22,8 +40,10 @@
|
|
22
40
|
|
23
41
|
Next myRange2
|
24
42
|
|
43
|
+
|
44
|
+
|
25
45
|
Next myRange1
|
26
46
|
|
47
|
+
コード
|
27
48
|
|
28
|
-
|
29
|
-
|
49
|
+
```
|