Analyze if ActiveCell is part of specified Range
Hi,
I'm trying to figure out how to get my macro to analyze if my ActiveCell is part of a specified Range. For instance, my ActiveCell is A2 but the Range I am analyzing against is Range("G:G"). Here is the code I'm working with:
1 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
2 Dim PubTag As Integer
3 Dim strCell As String
4 Dim rngCell As Range
5 Dim rngClick As Range
6 If IsEmpty(Target) Then
7 Set rngClick = Range(Target.Address & Target.Address).Select
8 If Range(rngClick) <> Range("G:G") Then
9 Exit Sub
10 Else
11 Range("G2").Select
12 Range(Selection, Selection.End(xlDown)).Select
13 PubTag = Selection.Cells.Count
14 End If
15 Else
16 Exit Sub
17 End If
18 End Sub
Line 8 of my code is where I'm stumped at how to get it to analyze if my ActiveCell is in the Range of G:G. I know what I currently have is not right. I've tried looking online but have not been able to find solutions that work with what I'm trying to accomplish.
I have to apologize. I am fairly new to VBA but any assistance or advice you have is much appreciated.
Kara
|