Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Change question???? 3

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I understand worksheet change events in VB, where if a cell changes in a worksheet it runs some code. But, what if I only want to run code if a certain column in that worksheet changes? Any help would be appreciated!! Thanks much

For just $19.95 you too can have a beautiful smile.
 

e.g to activate on column 3 changes only

Private Sub Worksheet_Change (ByVal Target as Range)

If Target.Column = 3 then
msgbox "Event Happens"
End if

End Sub
 
Hmmm... I like it! Can that be done for a single cell, say C14? [ponder]



Chris

Varium et mutabile semper Excel
 
yup
If target.address = "$C$14" then
msgbox "there ya go"
end if

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
You get some props from me Dr. Here's a star it may not mean much but here you go.


Mr. Rib

For just $19.95 you too can have a beautiful smile.
 
By the way xlbo technically the .Address doesn't really work does it? The action will happen if the user just selects C14. What happens if you only want the message to pop up when the user changes C14?

For just $19.95 you too can have a beautiful smile.
 
No - you are using the worksheet CHANGE event therefore, it will fire whenever the worksheet is changed. What the
If target.address = "$C$14" then

does is check to see if the cell that was changed was C14

Target refers to the changed cell therefore target.address refers to the address of the changed cell.

What you are talking about is the worksheet SELECTION CHANGE event



Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Works just splendiferously for me, Ribhead, even when Copy/Pasting which I didn't expect! [flip]

Doc & Geoff, STARS and gongs for both of you! [medal] [medal] [thumbsup2]



Chris

Varium et mutabile semper Excel
 
A Bodda bing a bodda boom. I did have the worsheet selection change. Boing???? Duhhhhh? I'm so blind. Thanks Gents.

For just $19.95 you too can have a beautiful smile.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top