Created
July 22, 2017 14:56
-
-
Save ndthanh/3768a542ef774bcd5faf919be2614155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub UnSelectCell() | |
'Updateby20140314 | |
Dim rng As Range | |
Dim InputRng As Range | |
Dim DeleteRng As Range | |
Dim OutRng As Range | |
xTitleId = "Hoc Excel Online" | |
Set InputRng = Application.Selection | |
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8) | |
Set DeleteRng = Application.InputBox("Delete Range", xTitleId, Type:=8) | |
For Each rng In InputRng | |
If Application.Intersect(rng, DeleteRng) Is Nothing Then | |
If OutRng Is Nothing Then | |
Set OutRng = rng | |
Else | |
Set OutRng = Application.Union(OutRng, rng) | |
End If | |
End If | |
Next | |
OutRng.Select | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment