代码改变世界

随笔分类 -  VBA初体验

Excel 删除行数据的同时删除当前行中的对象

2014-07-25 01:15 by xyantelope, 363 阅读, 收藏,
摘要: Private Sub Worksheet_Change(ByVal Target As Range)Dim srg As Range, x As ShapeIf Target.Count = Target.EntireRow.Cells.Count Then For Each x In Shapes If x.Top >= Target(1).Top And x.Top < Target(1)... 阅读全文

VBA 判断文件的路径是否有效的方法

2014-07-25 00:39 by xyantelope, 1769 阅读, 收藏,
摘要: Sub aa()Dim fsovar path = "c:\test.txt"Set fso = CreateObject("Scripting.FileSystemObject")If fso.FileExists(path ) ThenMsgBox "路径正确,文件存在"ElseMsgBox "路径不正确,文件不存在"End IfEnd Sub 阅读全文