Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Sub UnSelectCell()
  2. 'Updateby20140314
  3. Dim rng As Range
  4. Dim InputRng As Range
  5. Dim DeleteRng As Range
  6. Dim OutRng As Range
  7. xTitleId = "Hoc Excel Online"
  8. Set InputRng = Application.Selection
  9. Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
  10. Set DeleteRng = Application.InputBox("Delete Range", xTitleId, Type:=8)
  11. For Each rng In InputRng
  12. If Application.Intersect(rng, DeleteRng) Is Nothing Then
  13. If OutRng Is Nothing Then
  14. Set OutRng = rng
  15. Else
  16. Set OutRng = Application.Union(OutRng, rng)
  17. End If
  18. End If
  19. Next
  20. OutRng.Select
  21. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement