Sub 按钮1_Click()
arr = Sheets(1).UsedRange
str1 = ""
str2 = ""
r = 1
arr(1, 3) = "坐标A"
arr(1, 4) = "坐标B"
For j = 2 To UBound(arr)
If Len(arr(j, 1)) > 0 Then
If Len(str1) > 0 Then
arr(r, 3) = str1
arr(r, 4) = str2
End If
r = r + 1
arr(r, 1) = arr(j, 1)
arr(r, 2) = arr(j, 2)
str1 = arr(j, 3) & "," & f_data(arr(j, 4)) & "," & f_data(arr(j, 5))
str2 = f_data(arr(j, 6)) & "," & f_data(arr(j, 7))
Else
str1 = str1 & Chr(10) & arr(j, 3) & "," & f_data(arr(j, 4)) & "," & f_data(arr(j, 5))
str2 = str2 & Chr(10) & f_data(arr(j, 6)) & "," & f_data(arr(j, 7))
End If
Next j
arr(r, 3) = str1
arr(r, 4) = str2
Sheets(2).[f1].Resize(r, 4) = arr
End Sub
Function f_data(num)
f_data = Format(num / 10000, "00.0000")
End Function
|