Trying to write a Union of Ranges Function

I get `Object variable or with block not set"

I am not getting this right (I think):

```
 With Rng
     UnionRange = Intersect(ws.UsedRange, Rng.EntireColumn)
 End With

Sub iUnionRange()
Dim R As Range

'Check to see if the Function is working
Set R = UnionRange("Elements", Range("A1:D1, G1:G1, I1:K1"))
R.Select

End Sub

```

The Function

```
Function UnionRange(shtName As String, Rng As Range) As Range

 Set ws = ThisWorkbook.Sheets(shtName)
 If Rng Is Nothing Then Exit Function

 With ws.Rng
     UnionRange = Intersect(ws.UsedRange, .EntireColumn)
 End With

End Function

```