VBA相关

  • 判断某文件夹是否存在某文件
Function fileFolderExists(strFullPath as String) as Boolean
    If Not Dir(strFullPath,vbDirectory)=vbNullString then
        fileFolderExists=true
    End If
End Function
  • 设置图形跟随单元格移动
Sub SetShapeInfo()
    Dim shape        As shape
    For Each shape In Activesheet.Shapes
        shape.Placement=xlMoveAndSize
    next
End Function
  • 印刷范围的获取与设置
Sub PrintAreaInfo()
    Dim printArea    As String
    printArea=ThisWorkbook.Range("Print_Area").Address
    ThisWorkbook.PageSetup.printArea=<Adsress>
End Sub
  • 列号转换为列名
    rangeName=replace(Cells(1,column).Address(0,0),"1","")
  • 列名转换为列号
    column=Range("A1:" & rangeName & "1").Cells.count
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。