Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Event Macro help

I have this change macro and in o1 I have the cell link for a combo-box.
When a value is selected in the combo-box the number changes in o1, but it
does not trigger my event macro because I'm not changing the value it's
simply updating from the combo-box.

How can I write my event macro so that it will trigger from a user changing
a value in my combo-box?

Have a good day!

Ted


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
On Error GoTo ErrHandler
If Not Intersect(Target, Range( _
"o1:o3, o1:o5")) Is Nothing Then
Application.EnableEvents = False
Range("h6:h10").Select
With Selection.Interior
.ColorIndex = 44
.Pattern = xlSolid
End With
End If
ErrHandler:
Application.EnableEvents = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Event Macro help

Right click the combo box View Code, and if it does not automatically
appear then click the declarations window and look for this:

Private Sub ComboBox1_Change()

End Sub

Put you code inside this and it will execute with each selection change.


"Ted Metro" wrote:

I have this change macro and in o1 I have the cell link for a combo-box.
When a value is selected in the combo-box the number changes in o1, but it
does not trigger my event macro because I'm not changing the value it's
simply updating from the combo-box.

How can I write my event macro so that it will trigger from a user changing
a value in my combo-box?

Have a good day!

Ted


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
On Error GoTo ErrHandler
If Not Intersect(Target, Range( _
"o1:o3, o1:o5")) Is Nothing Then
Application.EnableEvents = False
Range("h6:h10").Select
With Selection.Interior
.ColorIndex = 44
.Pattern = xlSolid
End With
End If
ErrHandler:
Application.EnableEvents = True
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Event Macro help

Wow, that was too easy. Thanks!!

"JLGWhiz" wrote:

Right click the combo box View Code, and if it does not automatically
appear then click the declarations window and look for this:

Private Sub ComboBox1_Change()

End Sub

Put you code inside this and it will execute with each selection change.


"Ted Metro" wrote:

I have this change macro and in o1 I have the cell link for a combo-box.
When a value is selected in the combo-box the number changes in o1, but it
does not trigger my event macro because I'm not changing the value it's
simply updating from the combo-box.

How can I write my event macro so that it will trigger from a user changing
a value in my combo-box?

Have a good day!

Ted


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
On Error GoTo ErrHandler
If Not Intersect(Target, Range( _
"o1:o3, o1:o5")) Is Nothing Then
Application.EnableEvents = False
Range("h6:h10").Select
With Selection.Interior
.ColorIndex = 44
.Pattern = xlSolid
End With
End If
ErrHandler:
Application.EnableEvents = True
End Sub

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
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
It seems to me that I need an event Macro, nick s Excel Worksheet Functions 8 November 28th 05 05:37 PM
Event Macro stevepain Excel Discussion (Misc queries) 6 August 5th 05 05:11 AM
Event macro? Kent Excel Programming 5 June 15th 04 02:54 AM
Event macro David McRitchie[_2_] Excel Programming 2 July 16th 03 06:20 PM


All times are GMT +1. The time now is 11:41 AM.

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

About Us

"It's about Microsoft Excel"