I think what you're saying is that you have a combobox on the worksheet (not in
a userform)
and your Worksheet_Change event works when you change a cell value, but not when
you change the combobox selection.
If that's the case, then there's nothing you can do about it.
The VALUE of the combobox is NOT the selection, but the LINK to the combobox
values.
Technically, what you SEE in the cell is actually a property of the combobox,
not the VALUE of the cell.
changing the selection does not change the LINK, therefore, the event doesn't
recognize that there has been any "change" to the worksheet.
You MIGHT be able to set up a Public variable.
Then utilize a SelectionChange event to compare the combobox property to the
public variable.
If it does not match, then update the variable and run your macro.
This would then run whenever you select ANY cell.
Paul
-----------------------------------------
"Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can." - John Wesley
-----------------------------------------
________________________________
From: Tayyab <sheikhtayyab@yahoo.com>
To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
Sent: Fri, May 31, 2013 9:12:51 AM
Subject: [ExcelVBA] auto run macro when link formula change
hi
I have a sheet that have a combo box selection menu to select code, when code is
selected sheet auto changes value. then also have a macro that I want to run .
macro only run when I change any cell value, but not run when changing the
combo option.
I make attach code. Please help
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("g6:i10") 'combo box link cell
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Call HideColumns 'macro call that to hided black columns
End If
End Sub
Thanks & regards
Tayyab
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar