|
Dim i As Long
Dim form1 As String
Dim form2 As String
Dim lngLineM As Long
Dim lngLineN As Long
Dim lngLineO As Long
Dim lngLineP As Long
Dim lngLineQ As Long
Dim lngLineR As Long
lngLineM = Range("M3").End(xlDown).Row / 2
lngLineN = Range("N3").End(xlDown).Row / 2
lngLineO = Range("O3").End(xlDown).Row / 2
lngLineP = Range("P3").End(xlDown).Row / 2
lngLineQ = Range("Q3").End(xlDown).Row / 2
lngLineR = Range("R3").End(xlDown).Row / 2
form1 = "=IF(R[@]C[11]="""","""",MID(R[@]C[11],1,FIND("" "",R[@]C[11],1)-1))"
form2 = "=IF(R[@]C[11]="""","""",R[@]C[11])"
For i = 3 To lngLineM Step 2 'lngLine Step 2
Range("B" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("B" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
For i = 3 To lngLineN Step 2
Range("C" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("C" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
For i = 3 To lngLineO Step 2
Range("D" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("D" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
For i = 3 To lngLineP Step 2
Range("E" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("E" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
For i = 3 To lngLineQ Step 2
Range("F" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("F" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
For i = 3 To lngLineR Step 2
Range("G" & i).FormulaR1C1 = Replace(form1, "@", i - 3)
Range("G" & i + 1).FormulaR1C1 = Replace(form2, "@", i - 2)
Next
参考?ほとんどそのまんまですが、なんとかできたみたいです。
ありがとうございました。
一回で質問すればよかったのですが
ActiveCell.FormulaR1C1 = "=IF(RC[11]="""","""",MID(RC[11],1,FIND("" "",RC[11],1)-1))"
Range("B4").Select
ActiveCell.FormulaR1C1 = "=IF(R[3]C[11]="""","""",MID(R[3]C[11],3,LEN(R[3]C[11])-2))"
Range("B5").Select
ActiveCell.FormulaR1C1 = "=IF(R[3]C[11]="""","""",MID(R[3]C[11],1,FIND("" "",R[3]C[11],1)-1))"
Range("B6").Select
ActiveCell.FormulaR1C1 = "=IF(R[6]C[11]="""","""",MID(R[6]C[11],3,LEN(R[6]C[11])-2))"
Range("B7").Select
ActiveCell.FormulaR1C1 = "=IF(R[6]C[11]="""","""",MID(R[6]C[11],1,FIND("" "",R[6]C[11],1)-1))"
Range("B8").Select
ActiveCell.FormulaR1C1 = "=IF(R[9]C[11]="""","""",MID(R[9]C[11],3,LEN(R[9]C[11])-2))"
Range("B9").Select
上記のようなデータもあるのですが、こちらはうまくいきません。
なんども申し訳ありませんがご教授のほど、よろしくお願いします。
|
|