Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default active range to run macro

Hello,

hi

any cell in between A1:B10 range is active macro will run
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default active range to run macro

hi,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set isect = Application.Intersect(Target, Range("A1:B10"))
If Not isect Is Nothing Then
MsgBox Target.Address
End If
End Sub


--
isabelle



Le 2012-02-07 12:45, kalpesh a écrit :
Hello,

hi

any cell in between A1:B10 range is active macro will run

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default active range to run macro

kalpesh wrote:

any cell in between A1:B10 range is active macro will run


This is a variation on the question you asked yesterday. Using a variation of
the code I posted there should work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case ActiveCell.Column
Case 1, 2
If ActiveCell.Row < 11 Then
'your code here
End If
End Select
End Sub

Put that in the worksheet's class and put your code where it says "your code
here".

--
I'm gonna go comatose for a few hours, hallucinate vividly,
and then maybe suffer amnesia about the whole experience.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default active range to run macro

Auric__ wrote:

kalpesh wrote:

any cell in between A1:B10 range is active macro will run


This is a variation on the question you asked yesterday. Using a
variation of the code I posted there should work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case ActiveCell.Column
Case 1, 2
If ActiveCell.Row < 11 Then
'your code here
End If
End Select
End Sub

Put that in the worksheet's class and put your code where it says "your
code here".


....or just use isabella's code, which I *think* might be faster and/or
"better" than mine.

--
Her braid felt equally permanent, as if her soul was woven in with it.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default active range to run macro

Auric__ formulated on Tuesday :
Auric__ wrote:

kalpesh wrote:

any cell in between A1:B10 range is active macro will run


This is a variation on the question you asked yesterday. Using a
variation of the code I posted there should work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case ActiveCell.Column
Case 1, 2
If ActiveCell.Row < 11 Then
'your code here
End If
End Select
End Sub

Put that in the worksheet's class and put your code where it says "your
code here".


...or just use isabella's code, which I *think* might be faster and/or
"better" than mine.


Actually, this is faster AND more efficient<g...

If Not Intersect(Target, Range("A1:B10")) Is Nothing Then _
MsgBox Target.Address

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




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
getting the selected range and active cell of a non active worksheetsheet GerryGerry Excel Programming 7 September 23rd 09 05:22 PM
macro to select range from active cell range name string aelbob Excel Programming 2 July 14th 08 09:19 PM
Pivot Table Macro - How to describe the Active range (so that themacro can be used on new sets of data) Dave K Excel Programming 1 February 9th 08 05:22 AM
Help: Macro Copy Active Cell to Range Name, loop [email protected] Excel Programming 3 March 30th 07 08:25 PM
Macro Copy Active Cell to Range Name, loop zigstick Excel Programming 6 April 27th 05 07:55 PM


All times are GMT +1. The time now is 06:49 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"