View Single Post
 
Old 07-02-2017, 05:04 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Declare and apply a range to the selection, while it is selected e.g.

Code:
Sub Macro1()
'Graham Mayor - http://www.gmayor.com - Last updated - 02 Jul 2017
Dim oRng As Range
    Set oRng = Selection.Range
    If Len(oRng) = 0 Then
        MsgBox "Nothing selected!"
    Else
        'do something with orng
    End If
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote