A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

I need help with macro



 
 
Thread Tools Display Modes
  #1  
Old December 29th, 2009, 12:47 AM posted to microsoft.public.excel.misc
mike
external usenet poster
 
Posts: 3,942
Default I need help with macro

I have this macro right now ,when i type anything in cell C300 the tab does
change colour this is what i want. Now i want to Type only QC in this cell so
that the tab changes colour is this possible with modijying this macro


Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
If Intersect(Target, Range("C300")) Is Nothing Then Exit Sub
ActiveSheet.Tab.ColorIndex = 15
End Sub


  #2  
Old December 29th, 2009, 01:02 AM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default I need help with macro

Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)

Dim myRngToInspect As Range

Set myRngToInspect = Sh.Range("C300")

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, myRngToInspect) Is Nothing Then
Exit Sub
End If

If LCase(Target.Value) = LCase("qc") Then
sh.Tab.ColorIndex = 3 'red for me
Else
sh.Tab.ColorIndex = xlNone 'change it back
End If

End Sub

Much like the other worksheet_change event in your other thread.

Mike wrote:

I have this macro right now ,when i type anything in cell C300 the tab does
change colour this is what i want. Now i want to Type only QC in this cell so
that the tab changes colour is this possible with modijying this macro

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
If Intersect(Target, Range("C300")) Is Nothing Then Exit Sub
ActiveSheet.Tab.ColorIndex = 15
End Sub


--

Dave Peterson
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:50 PM.


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