标签:
Sub Macro2()
‘
‘ Macro2 Macro
‘
‘ 快捷键: Ctrl+s
‘
Dim I1 As Integer
I1 = 1
//for 循环a1-a末尾
For I = 2 To Range("a65536").End(xlUp).Row
s = Worksheets("Sheet1").Cells(I, 1)
If Len(s) > 20 Then
I1 = I1 + 1
Sheet2.Cells(I1, 1) = Worksheets("Sheet1").Cells(I, 1)
Sheet2.Cells(I1, 1).HorizontalAlignment = xlCenter
Sheet2.Cells(I1, 1).VerticalAlignment = xlCenter
Sheet2.Cells(I1, 2) = Worksheets("Sheet1").Cells(I, 2)
Sheet2.Cells(I1, 2).HorizontalAlignment = xlCenter
Sheet2.Cells(I1, 2).VerticalAlignment = xlCenter
Sheet2.Cells(I1, 3) = Worksheets("Sheet1").Cells(I, 3)
Else
Sheet2.Cells(I1, 4) = Sheet2.Cells(I1, 4) + Worksheets("Sheet1").Cells(I, 1) + "、"
Sheet2.Cells(I1, 4).HorizontalAlignment = xlCenter
Sheet2.Cells(I1, 4).VerticalAlignment = xlCenter
End If
Next
Sheet2.[A1].Resize(1, 1).Value = "保单号"
Sheet2.[A1].HorizontalAlignment = xlCenter
Sheet2.[A1].VerticalAlignment = xlCenter
Sheet2.[B1].Resize(1, 1).Value = "案件数量"
Sheet2.[B1].HorizontalAlignment = xlCenter
Sheet2.[B1].VerticalAlignment = xlCenter
Sheet2.[c1].Resize(1, 1).Value = "理赔金额"
Sheet2.[c1].HorizontalAlignment = xlCenter
Sheet2.[c1].VerticalAlignment = xlCenter
Sheet2.[d1].Resize(1, 1).Value = "出险地点"
Sheet2.[d1].HorizontalAlignment = xlCenter
Sheet2.[d1].VerticalAlignment = xlCenter
MsgBox ("执行完毕")
End Sub
标签:
原文地址:http://www.cnblogs.com/110abcd/p/5057192.html