|
本帖最后由 Shelvee 于 2013-2-24 21:26 编辑
如题。。。。。。。。。。。。。。。。
- Private Sub 写入表格(ByVal lastrow As Long)
- Dim i&
- Application.ScreenUpdating = False
- With Worksheets("通信录")
- .Cells(lastrow, 1) = 姓名.Text
- .Cells(lastrow, 2) = IIf(男.Value, "男", "女")
- .Cells(lastrow, 3) = 关系.Text
- .Cells(lastrow, 4) = 联系方式.Text
- .Cells(lastrow, 5) = 邮编.Text
- .Cells(lastrow, 6) = 家庭住址.Text
- i = .Cells(Rows.Count, 1).End(xlUp).Row
- If i < 2 Then Exit Sub
- With .Sort
- .SortFields.Clear
- .SortFields.Add Key:=Range("C2:C" & i), _
- SortOn:=xlSortOnValues, Order:=xlAscending
- .SetRange Range("A1:F" & i)
- .Header = xlYes
- .Apply
- End With
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码判断写错了。给你的是后来又改了就没测了,
|
|