BCB操作Excel问题
vExcelApp.OleFunction("RUN","group");vExcelApp.OlePropertyGet("ActiveWorkbook").OleFunction("SaveAs", strXlsFile.c_str());
Sub group() Dim arr, brr(), i&, j&, m& Application.ScreenUpdating = False Application.DisplayAlerts = False arr = Range("A1").CurrentRegion ReDim brr(1 To UBound(arr)) For i = 3 To UBound(arr) If arr(i, 1) <> arr(i - 1, 1) Then m = m + 1 brr(m) = i End If Next brr(m + 1) = i For j = 1 To 8 For l = 1 To m For i = brr(l) + 1 To brr(l + 1) - 1 If arr(i, j) = arr(i - 1, j) Then Cells(i - 1, j).Resize(2).Merge Next Next Next Application.ScreenUpdating = TrueEnd Sub