Sub wa() ' ' wa Macro ' マクロ記録日 : 2002/09/28 ユーザー名 : H.Miyamoto ' ' Dim MEAS(100): Dim MM(4): Dim NN(4): L = 0: GCM = 1 Sheets("和差").Select LA = 2: CO = 1: a = 1 GoSub yakubun LA = 2: CO = 3: a = 2 GoSub yakubun M = NN(1): N = NN(2) GoSub multiple M = MM(1) * LCM / NN(1) + MM(2) * LCM / NN(2) N = LCM GoSub measure Range("F2") = M / GCM Range("F3") = N / GCM Sheets("和差").Select Range("A1") = "和を計算しました。 " + Str(Now()): Range("A1:F1").Select Exit Sub '~~~~~~~~ SUB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ yakubun: If Cells(LA, CO) > Cells(LA + 1, CO) Then M = Cells(LA + 1, CO): N = Cells(LA, CO) Else M = Cells(LA, CO): N = Cells(LA + 1, CO) End If GoSub measure MM(a) = Cells(LA, CO) / GCM NN(a) = Cells(LA + 1, CO) / GCM Return measure: For K = 1 To M If (M Mod K) = 0 Then L = L + 1: MEAS(L) = K Next For K = 1 To L If (N Mod MEAS(K)) = 0 Then GCM = MEAS(K) Next Return multiple: GoSub measure LCM = M * N / GCM Return End Sub