Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
楼主: Shelvee

[已解决]表单控件怎么美化啊

[复制链接]
 楼主| 发表于 2013-2-23 22:00 | 显示全部楼层
hwc2ycy 发表于 2013-2-23 21:44
发了。你下吧。

大神,你不要嫌我烦!如果我想把同一类关系自动归类要怎么办呢?
回复

使用道具 举报

发表于 2013-2-23 22:04 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2013-2-23 22:09 | 显示全部楼层
hwc2ycy 发表于 2013-2-23 22:04
同一类的放到一起?那用排序。

排序需要每次输入号码之后手动操作,有没有什么办法可以新建联系人加到通信录之后,自动就归类啊?
回复

使用道具 举报

发表于 2013-2-23 22:22 | 显示全部楼层
本帖最后由 hwc2ycy 于 2013-2-23 22:25 编辑
  1. Private Sub 写入表格(ByVal lastrow As Long)
  2.     Dim i&
  3.     Application.ScreenUpdating = False
  4.     With Worksheets("通信录")
  5.         .Cells(lastrow, 1) = 姓名.Text
  6.         .Cells(lastrow, 2) = IIf(男.Value, "男", "女")
  7.         .Cells(lastrow, 3) = 关系.Text
  8.         .Cells(lastrow, 4) = 联系方式.Text
  9.         .Cells(lastrow, 5) = 邮编.Text
  10.         .Cells(lastrow, 6) = 家庭住址.Text
  11.         i = .Cells(Rows.Count, 1).End(xlUp).Row
  12.         If i > 2 Then Exit Sub
  13.         With .Sort
  14.             .SortFields.Clear
  15.             .SortFields.Add Key:=Range("C2:C" & i), _
  16.                             SortOn:=xlSortOnValues, Order:=xlAscending
  17.             .SetRange Range("A1:F" & i)
  18.             .Header = xlYes
  19.             .Apply
  20.         End With
  21.     End With
  22.     Application.ScreenUpdating = True
  23. End Sub
复制代码
回复

使用道具 举报

 楼主| 发表于 2013-2-23 22:39 | 显示全部楼层
hwc2ycy 发表于 2013-2-23 22:22

好像不行诶。。。
回复

使用道具 举报

发表于 2013-2-23 22:46 | 显示全部楼层
我这已经排序了呀。
回复

使用道具 举报

 楼主| 发表于 2013-2-23 22:49 | 显示全部楼层
hwc2ycy 发表于 2013-2-23 22:46
我这已经排序了呀。

诶?我把这段代码加在aaa里了,难道是加在用户窗体里的么?
回复

使用道具 举报

发表于 2013-2-23 22:51 | 显示全部楼层
当然要放窗体里,原来的同名过程删除。
回复

使用道具 举报

 楼主| 发表于 2013-2-23 22:55 | 显示全部楼层
hwc2ycy 发表于 2013-2-23 22:51
当然要放窗体里,原来的同名过程删除。

{:021:}我还是不行- -
回复

使用道具 举报

发表于 2013-2-23 23:01 | 显示全部楼层    本楼为最佳答案   
  1. Private Sub 写入表格(ByVal lastrow As Long)
  2.     Dim i&
  3.     Application.ScreenUpdating = False
  4.     With Worksheets("通信录")
  5.         .Cells(lastrow, 1) = 姓名.Text
  6.         .Cells(lastrow, 2) = IIf(男.Value, "男", "女")
  7.         .Cells(lastrow, 3) = 关系.Text
  8.         .Cells(lastrow, 4) = 联系方式.Text
  9.         .Cells(lastrow, 5) = 邮编.Text
  10.         .Cells(lastrow, 6) = 家庭住址.Text
  11.         i = .Cells(Rows.Count, 1).End(xlUp).Row
  12.         If i < 2 Then Exit Sub
  13.         With .Sort
  14.             .SortFields.Clear
  15.             .SortFields.Add Key:=Range("C2:C" & i), _
  16.                             SortOn:=xlSortOnValues, Order:=xlAscending
  17.             .SetRange Range("A1:F" & i)
  18.             .Header = xlYes
  19.             .Apply
  20.         End With
  21.     End With
  22.     Application.ScreenUpdating = True
  23. End Sub
复制代码
判断写错了。给你的是后来又改了就没测了,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-7 07:46 , Processed in 0.345686 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表