#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Cell change

I'm kinda new to excel vba. I'm trying to make excel
launch a sub when a cell i a range is changed.

code as of now:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'StrOmraarde$ = "e16:e1000"

Adresse$ = "$E$25,$E$40"
If Target.Count 1 Then Exit Sub
If Target.Address = "$F$25" Then
MsgBox ("test1")
Else
MsgBox ("test2")

End If

End Sub

This works fine, but I need address to be a range
ie. "E16,E55".

How do I do that??

Thanks
Lars Kofod
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cell change

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'StrOmraarde$ = "e16:e1000"

Adresse$ = "$E$25,$E$40"
If Target.Count 1 Then Exit Sub
If not intersect(Target,Range("E25:E40")) Then
MsgBox ("test1")
Else
MsgBox ("test2")

End If

End Sub

If you really mean just the two cells E25 and E40, then change it to

intersect(Target,Range("E24,E40"))

--
Regards,
Tom Ogilvy


"lars kofod" wrote in message
...
I'm kinda new to excel vba. I'm trying to make excel
launch a sub when a cell i a range is changed.

code as of now:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'StrOmraarde$ = "e16:e1000"

Adresse$ = "$E$25,$E$40"
If Target.Count 1 Then Exit Sub
If Target.Address = "$F$25" Then
MsgBox ("test1")
Else
MsgBox ("test2")

End If

End Sub

This works fine, but I need address to be a range
ie. "E16,E55".

How do I do that??

Thanks
Lars Kofod



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
change cell contents when pull down menu choices change jb21 Excel Worksheet Functions 3 November 21st 08 10:34 PM
making copied cells change with change in original cell Jennifer Mcdermeit Excel Worksheet Functions 2 July 20th 06 04:58 PM
How do I change a number in one cell to change a series of cells? lance559 Excel Discussion (Misc queries) 2 January 13th 06 08:56 PM
excel deleting rows last cell does not change. How to change? mrubey Excel Discussion (Misc queries) 3 August 25th 05 08:38 PM
Change workbook sheet reference using cell A1 to change a vairable Reed Excel Worksheet Functions 4 January 20th 05 07:15 PM


All times are GMT +1. The time now is 09:40 AM.

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"