反选EXCEL数据区域已选定的单元格

4740人阅读 评论(0) 收藏 举报

Sub 反选()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim raddress As String, taddress As String
raddress = Selection.Address
taddress = ActiveSheet.UsedRange.Address
With Sheets.Add
.Range(taddress) = 0
.Range(raddress) = "=0"
raddress = .Range(taddress).SpecialCells(xlCellTypeConstants, 1).Address
.Delete
End With
ActiveSheet.Range(raddress).Select
Application.ScreenUpdating = True
End Sub

 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:631392次
    • 积分:8218
    • 等级:
    • 排名:第2411名
    • 原创:205篇
    • 转载:26篇
    • 译文:1篇
    • 评论:213条
    最新评论