ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro error (https://www.excelbanter.com/excel-discussion-misc-queries/252914-macro-error.html)

Mike

Macro error
 
This is the Macro im using & i know why im getting an error (i have a
password for protecting structure) is there any possible way i can do this &
change Macro to accomodate & how i am not very good with Macro,s



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 UCase(Target.Value) = UCase("QC") Then
Sh.Tab.ColorIndex = 3 'red for me
Else
Sh.Tab.ColorIndex = 2 'White for me
End If

End Sub


s is the Macro im using & I know why im getting an error

Bob Phillips[_4_]

Macro error
 
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Dim myRngToInspect As Range

Me.Unprotect "password"

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 UCase(Target.Value) = UCase("QC") Then
Sh.Tab.ColorIndex = 3 'red for me
Else
Sh.Tab.ColorIndex = 2 'White for me
End If

Me.Protect "password"

End Sub


---
HTH

Bob Phillips


"Mike" wrote in message
...
This is the Macro im using & i know why im getting an error (i have a
password for protecting structure) is there any possible way i can do
this &
change Macro to accomodate & how i am not very good with Macro,s



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 UCase(Target.Value) = UCase("QC") Then
Sh.Tab.ColorIndex = 3 'red for me
Else
Sh.Tab.ColorIndex = 2 'White for me
End If

End Sub


s is the Macro im using & I know why im getting an error





All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com