Krishnab4u
New Member
- Joined
- Jul 16, 2018
- Messages
- 34
Dear All,
Following code is to highlight the Row in the given range when a cell is selected.
This codes works perfectly alright until the time the workbook is Shared.
"Application defined or Object defined error" is shown when the workbook is Shared.
Please help, what is wrong.
Regards
Krishnamoorthy S
Following code is to highlight the Row in the given range when a cell is selected.
This codes works perfectly alright until the time the workbook is Shared.
"Application defined or Object defined error" is shown when the workbook is Shared.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rownnumber As Integer
'Dim AcSheet As Worksheet
rownumber = ActiveCell.Row
If Application.Intersect(ActiveCell, [DATAHEADER]) Is Nothing Then
If Application.Intersect(ActiveCell, [MAINTABLE]) Is Nothing Then
If ActiveCell.Value <> "" Then
If ActiveSheet.Protect = True Then
ActiveSheet.Unprotect Password:=""
ActiveSheet.Protect AllowFormattingCells:=True
ActiveSheet.Protect AllowFiltering:=True
Range("B3:Z500").Interior.ColorIndex = xlNone
Range("B" & rownumber & ":Z" & rownumber).Interior.Color = RGB(204, 255, 153)
ActiveSheet.Protect AllowFiltering:=True
ActiveSheet.Protect Password:=""
Else
ActiveSheet.Protect AllowFormattingCells:=True
Range("B3:Z500").Interior.ColorIndex = xlNone
ActiveSheet.Range("B" & rownumber & ":Z" & rownumber).Interior.Color = RGB(204, 255, 153)
ActiveSheet.Protect Password:=""
End If
End If
End If
End If
End Sub
Please help, what is wrong.
Regards
Krishnamoorthy S
Last edited: