Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 14th, 2007, 05:17 PM
Registered User
 
Join Date: Jun 2007
Location: Eagan, MN, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old June 14th, 2007, 09:12 PM
Authorized User
 
Join Date: Sep 2006
Location: , NH, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try If ActiveCell.Column <> Range("G:G").Column Then
    'code
Else
    'code
End If
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Analyze of a Blob yanis97 Java Databases 0 September 16th, 2006 12:04 PM
Analyze of a BLOB yanis97 J2EE 0 September 8th, 2006 05:37 AM
Activecell Address vemaju Excel VBA 2 January 4th, 2006 12:36 PM
HYPERLINK in activecell icayan Excel VBA 4 May 24th, 2005 12:22 PM
changing ActiveCell sedolphi Excel VBA 1 May 17th, 2004 02:37 PM



All times are GMT -4. The time now is 01:10 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.