找回密码
 加入
搜索
查看: 4267|回复: 10

[AU3基础] [已解决]请教EXCEL自定义函数,有没有用来清除指定单元格内容的?

  [复制链接]
发表于 2013-5-5 16:01:21 | 显示全部楼层 |阅读模式
本帖最后由 smooth 于 2013-5-10 09:18 编辑

请教EXCEL自定义函数,有没有用来清除指定单元格内容的?帮助里那几个函数我看了,都没有。谢谢!
发表于 2013-5-5 16:40:27 | 显示全部楼层
range("a1").clearcontents 清格单元格
range("a1").clear 清除全部(内容、格式、边框等)
 楼主| 发表于 2013-5-5 16:44:56 | 显示全部楼层
回复 2# kevinch

非常感谢,请问这些用法在哪里可以找到,帮助里好像没有。
发表于 2013-5-5 16:48:44 | 显示全部楼层
能分清方法,事件,属性,集合之类的后,可以到帮助文件的方法里去找
 楼主| 发表于 2013-5-5 19:05:03 | 显示全部楼层
回复 4# kevinch

所言极是,谢谢!
发表于 2013-5-6 10:50:11 | 显示全部楼层
回复 5# smooth

還有個方法  ...請用EXCEL 錄製 巨集  然後 操作你想操作的,然後停止錄製巨集,再去編輯你剛剛錄製的巨集,  就可以看到 剛剛錄製的東西,然後再稍微轉換一下 就可以用在AU3上了,絕大部分的基礎操作 用這個方法 就可以知道了
 楼主| 发表于 2013-5-18 11:52:38 | 显示全部楼层
回复 6# kk_lee69
不好意思,请问什么叫  錄製 巨集 ?是录制宏么?
发表于 2013-5-18 13:12:23 | 显示全部楼层
回复 7# smooth

恩  就是 宏................台灣叫做 巨集
 楼主| 发表于 2013-5-18 13:20:16 | 显示全部楼层
回复 8# kk_lee69
OK,感谢台湾的兄弟啦!有不懂再请教你。
 楼主| 发表于 2013-5-18 16:04:56 | 显示全部楼层
回复 8# kk_lee69

兄弟,如何将下面这段宏代码,写成AU3格式?没这么玩过。
Sub 宏1()
'
' 宏1 宏
'

'
    Columns("A:A").EntireColumn.AutoFit
    Columns("G:G").EntireColumn.AutoFit
    Columns("F:F").EntireColumn.AutoFit
    Columns("E:E").EntireColumn.AutoFit
    Rows("1:13").Select
    Selection.RowHeight = 17
    Range("C2:D4").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("F2:G4").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("C6:D8").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("F6:G8").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("C10:D10").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("F10:G10").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("C12:D13").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("F12:G13").Select
    Selection.NumberFormatLocal = "#,##0.00_ "
    Range("C5:D5").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("F5:G5").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("C9:D9").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("F9:G9").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("C11:D11").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("F11:G11").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("E2:E13").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("H2:H13").Select
    Selection.NumberFormatLocal = "0.00%"
    Range("C2:H13").Select
    With Selection
        .HorizontalAlignment = xlRight
        .VerticalAlignment = xlCenter
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("D8").Select
   
        Range("A1:H13").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Range("D5").Select
   
End Sub
发表于 2013-5-18 16:13:37 | 显示全部楼层
你這是  設定格式 畫線.......
這些都屬於基礎操作   有個 文章 可以先寄住
http://www.autoitx.com/forum.php ... amp;highlight=EXCEL

另外我要說的意思是   譬如 你剛剛上面錄下的 其中
   Range("C9:D9").Select
    Selection.NumberFormatLocal = "0.00%"

其實轉換成 AU3語法就變成
$oexcel.Range("C9:D9").NumberFormatLocal = "0.00%"

變成這樣的一行

至於怎麼便 多看多練習  重點是  至少有方向 可以測試
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-4 06:40 , Processed in 0.076142 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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