Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Target.Address Question

How do you use If Target.Address = _____ Then for more than one cells.

The cells I want are
F67 Or F73 Or F79 Or F85 Or F91 Or F97 Or F103 Or F109 Or F115 Or F121 Or
F127 Or F133 Or F139 Or F145

Thanks for your help in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Target.Address Question

Sub dural()
Set r =
Range("F67,F73,F79,F85,F91,F97,F103,F109,F115,F121 ,F127,F133,F139,F145")
MsgBox (r.Address)
Set Target = ActiveCell
If Intersect(Target, r) Is Nothing Then
' do something
Else
'do something else
End If
End Sub

--
Gary''s Student - gsnu200846


"Leiprecht" wrote:

How do you use If Target.Address = _____ Then for more than one cells.

The cells I want are
F67 Or F73 Or F79 Or F85 Or F91 Or F97 Or F103 Or F109 Or F115 Or F121 Or
F127 Or F133 Or F139 Or F145

Thanks for your help in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Target.Address Question

Hi

Look at this:

Set TestRange = Range _
("F67 , F73, F79, F85, F91, F97, F103, F109, F115, F121, F127, F133,
F139, F145")
Set isect = Intersect(Target, TestRange)
If Not isect Is Nothing Then
MsgBox ("Target intersect with TestRange")
End If

Hopes this helps

---
Per

"Leiprecht" skrev i meddelelsen
...
How do you use If Target.Address = _____ Then for more than one cells.

The cells I want are
F67 Or F73 Or F79 Or F85 Or F91 Or F97 Or F103 Or F109 Or F115 Or F121 Or
F127 Or F133 Or F139 Or F145

Thanks for your help in advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Target.Address Question

Given the regularity of your ranges (they all differ by 6), you can use this
mathematical relationship to test if the Target row is within your range...

If Abs(Target.Row - 106) <= 39 And ((Target.Row - 67) Mod 6 = 0) Then

--
Rick (MVP - Excel)


"Leiprecht" wrote in message
...
How do you use If Target.Address = _____ Then for more than one cells.

The cells I want are
F67 Or F73 Or F79 Or F85 Or F91 Or F97 Or F103 Or F109 Or F115 Or F121 Or
F127 Or F133 Or F139 Or F145

Thanks for your help in advance.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you use a Range $N$xx:$Q$xx in Target.Address? CRayF Excel Programming 7 December 14th 06 09:11 PM
UCase with Worksheet_Change and Target Address David Excel Programming 2 August 30th 06 03:17 AM
Using Target.Address in Excel 98 Noemi Excel Discussion (Misc queries) 2 November 7th 05 01:36 PM
Target.Address syntax Coolboy55 Excel Worksheet Functions 3 August 23rd 05 12:23 AM
target address Mark Kubicki Excel Programming 2 October 31st 03 04:19 PM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"