选中A列插入一列,隐藏A列,再这段试试, Sub tgddn() Application.ScreenUpdating = False r = 7 cc = Sheet1.[b65536].End(xlUp).Row Sheet1.Rows(r & ":" & 65536).Delete x = Sheet4.[a65536].End(xlUp).Row
Dim arry(1 To 19) For i = 1 To x If Sheet4.Cells(i, "a") = Sheet1.[d1] Then Sheet4.Rows(i).Copy Sheet1.Rows(r).PasteSpecial Paste:=xlPasteValues Sheet1.Rows(r).PasteSpecial Paste:=xlPasteFormats r = r + 1 End If Next i Application.CutCopyMode = False Set d = Sheet5.Range("a:a").Find(Sheet1.[d1]) Sheet1.Range(Cells(r, 2), Cells(r, "s")).Merge Sheet1.Cells(r, 2).WrapText = True Sheet1.Cells(r, "b") = Sheet5.Cells(d.Row, "b") For g = 2 To Sheet1.Cells(r, "s").Column o = Sheet1.Cells(r, g).ColumnWidth u = u + o Next p = Len(Sheet1.Cells(r, 2)) h = p / u n = Sheet1.Rows(r).Height cce = Right(Round(h, 1) * 10, 1) If cce >= 1 Then Sheet1.Rows(r).RowHeight = n * (Int(h) + 1) ElseIf cce = 0 Then Sheet1.Rows(r).RowHeight = n * Int(h) End If Application.ScreenUpdating = True End Sub |