[VBA] 一点点分享

分享1


            [原本]
            Dim i
            Dim j
          
            Dim的用法比较好的用法是 >>> Dim 变量名 As 数据类型
            [例子]
            Dim i as integer
            Dim j as integer

            Dim i as range
            Dim j as range
            
            视乎你的变量是什么数据类型
          
          



分享2


            [原本]
            ActiveSheet.Range("$A$10:$Q$2011").AutoFilter Field:=15
            ActiveSheet.Range("$A$10:$Q$2011").AutoFilter Field:=15, Criteria1:="xxx"
          
            有时间的话,可以去了解如何使用With...End with
            [例子]
            With ActiveSheet.Range("$A$10:$Q$2011")
              .AutoFilter Field:=15
              .AutoFilter Field:=15, Criteria1:="Åã¥Ü"
            End With
        
            目的是可以更好的维护你的代码
          
          



分享3


您的文件里面有5个module, 可以的话,每一个module都应该赋予名字,以后查找代码比较方便




分享4


希望你可以去了解如何使用option explicit和她的好处




Source: ---


Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.


© 2023 sunnypeaceisland.com