Using
Private Sub Worksheet_Change(ByVal Target As Range)
How do you select a perticular range like b5 - b15
found for a single cell but not a range
Using
Private Sub Worksheet_Change(ByVal Target As Range)
How do you select a perticular range like b5 - b15
found for a single cell but not a range
I'm a newbie but, I used this for one of my worksheet change events. If
you have it set for a single cell. Target = Range("B5"), could you not
just use Range("B5:B15") ?
Dim myrow&, myCol&
myrow = Target.Row
myCol = Target.Column
If myrow > 0 And myrow < 100 Then
If myCol > 0 And myCol < 100 Then
If Not Intersect(Target,Range("B5:B15)) Is Nothing Then
'it is one of B5:B15
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Dan" <Dan@discussions.microsoft.com> wrote in message
news:3D1AF1E2-4D06-485F-868F-20C8D84EBA55@microsoft.com...
> Using
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> How do you select a perticular range like b5 - b15
>
> found for a single cell but not a range
Private Sub Worksheet_Change(ByVal Target As Range)
if Union(Target,Range("B5:B15")).Address = "$B$5:$B$15" then
end if
End Sub
if you want to react to only a change in a single cell in the Range B5:B15
Private Sub Worksheet_Change(ByVal Target As Range)
if Target.count > 1 then exit sub
if Not Intersect(Target,Range("B5:B15")) is nothing then
end if
End Sub
--
Regards,
Tom Ogilvy
"Dan" <Dan@discussions.microsoft.com> wrote in message
news:3D1AF1E2-4D06-485F-868F-20C8D84EBA55@microsoft.com...
> Using
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> How do you select a perticular range like b5 - b15
>
> found for a single cell but not a range
Thanks for looking, got it:
Set myRange = Intersect(Range("b5:b15"), Target)
If Not myRange Is Nothing Then
' your code
End If
Cheers
"Dan" wrote:
> Using
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> How do you select a perticular range like b5 - b15
>
> found for a single cell but not a range
Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A2:A10"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Value = Target.Value * 0.3
Application.EnableEvents = True
End Sub
This looks for changes in a certain range
--
Gary's Student
"Dan" wrote:
> Using
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> How do you select a perticular range like b5 - b15
>
> found for a single cell but not a range
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks