Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2007

Tip: Looking for answers? Try searching our database.

running some VBA code in response to data entered in a cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mantrid - 23 Apr 2007 22:48 GMT
hello again
Can anyone tell me if it is possible to trigger some VBA code when a number
entered in a particular cell on a worksheet is less than the number in
another cell?. I dont know if cells have events linked to them such as mouse
down etc

Thanks
Ian
Nick Hodge - 23 Apr 2007 23:05 GMT
Mantrid

You could use the worksheet_change event like so. Checks a value in A1 and
if below 10 it colours B1 red

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
   If Target.Value < 10 Then
       Target.Offset(0, 1).Interior.Color = RGB(255, 0, 0)
   Else
       Target.Offset(0, 1).Interior.ColorIndex = xlNone
   End If
End If
End Sub

To install right-click the sheet tab and select 'view code...'

Signature

HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS
web: www.nickhodge.co.uk
blog: www.nickhodge.co.uk/blog/

FREE UK OFFICE USER GROUP MEETING, MS READING, 27th APRIL 2007
www.officeusergroup.co.uk

> hello again
> Can anyone tell me if it is possible to trigger some VBA code when a
[quoted text clipped - 6 lines]
> Thanks
> Ian
mantrid - 24 Apr 2007 19:50 GMT
Thanks again Nick
I think that is the kind of think I need. I will have a play and see if I
can get it to do what I need.
Ian

> Mantrid
>
[quoted text clipped - 23 lines]
> > Thanks
> > Ian
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.