Hi Guys,
I get following error message when I try to run the codes below. There are total 114 row in the actual sheet. I am only allowed to post some due to the limitation of 10000 characters per message.
First error message: Run Time Error 28, Out of Stack Space
Another error message: Run Time Error '-2147417848 (80010108)': Method 'Select' of object 'Range' failed
>>> use correct CODE -tags <<<
I get following error message when I try to run the codes below. There are total 114 row in the actual sheet. I am only allowed to post some due to the limitation of 10000 characters per message.
First error message: Run Time Error 28, Out of Stack Space
Another error message: Run Time Error '-2147417848 (80010108)': Method 'Select' of object 'Range' failed
>>> use correct CODE -tags <<<
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Protection for the header fields
If Target.Address = "$A$1" Or Target.Address = "$B$1" Or Target.Address = "$C$1" Or Target.Address = "$D$1" Or Target.Address = "$E$1" Or Target.Address = "$L$1" Then Target.Offset(1, 0).Select
If Target.Address = "$A$2" Or Target.Address = "$C$2" Or Target.Address = "$E$2" Or Target.Address = "$F$2" Then Target.Offset(1, 0).Select
If Target.Address = "$A$3" Or Target.Address = "$B$3" Or Target.Address = "$C$3" Or Target.Address = "$D$3" Or Target.Address = "$E$3" Then Target.Offset(1, 0).Select
If Target.Address = "$F$3" Or Target.Address = "$G$3" Or Target.Address = "$H$3" Or Target.Address = "$I$3" Or Target.Address = "$J$3" Or Target.Address = "$K$3" Or Target.Address = "$L$3" Then Target.Offset(1, 0).Select
If Target.Address = "$A$4" Or Target.Address = "$C$4" Or Target.Address = "$D$4" Or Target.Address = "$L$4" Then Target.Offset(1, 0).Select
If Target.Address = "$F$4" And [$L$2].Value <> "Oph_Phase II_POC" Then Target.Offset(1, 0).Select
If Target.Address = "$A$5" Or Target.Address = "$C$5" Or Target.Address = "$C$5" Or Target.Address = "$F$5" Or Target.Address = "$G$5" Or Target.Address = "$H$5" Or Target.Address = "$I$5" Then Target.Offset(1, 0).Select
'Protection for row # 6
If Target.Address = "$A$7" Or Target.Address = "$C$7" Or Target.Address = "$D$7" Or Target.Address = "$E$7" Or Target.Address = "$F$7" Or Target.Address = "$G$7" Then Target.Offset(1, 0).Select
'Protection for row # 7
If Target.Address = "$A$6" Or Target.Address = "$B$6" Or Target.Address = "$C$6" Or Target.Address = "$D$6" Or Target.Address = "$E$6" Or Target.Address = "$F$6" Or Target.Address = "$G$6" Then Target.Offset(1, 0).Select
'Protection for row # 8
If Target.Address = "$A$8" Or Target.Address = "$B$8" Or Target.Address = "$C$8" Or Target.Address = "$D$8" Or Target.Address = "$E$8" Or Target.Address = "$F$8" Or Target.Address = "$G$8" Then Target.Offset(1, 0).Select
'Protection for row # 9
If Target.Address = "$F$9" Or Target.Address = "$G$9" Then Target.Offset(1, 0).Select
'Protection for row # 10
If Target.Address = "$F$10" Or Target.Address = "$G$10" Then Target.Offset(1, 0).Select
'Protection for row # 11
If Target.Address = "$F$11" Or Target.Address = "$G$11" Then Target.Offset(1, 0).Select
'Protection for row # 12
If Target.Address = "$F$12" Or Target.Address = "$G$12" Then Target.Offset(1, 0).Select
'Protection for row # 13
If Target.Address = "$F$13" Or Target.Address = "$G$13" Then Target.Offset(1, 0).Select
'Protection for row # 14
If Target.Address = "$F$14" Or Target.Address = "$G$14" Then Target.Offset(1, 0).Select
'Protection for row # 15
If Target.Address = "$F$15" Or Target.Address = "$G$15" Then Target.Offset(1, 0).Select
'Protection for row # 16
If Target.Address = "$F$16" Or Target.Address = "$G$16" Then Target.Offset(1, 0).Select
'Protection for row # 17
If Target.Address = "$F$17" Or Target.Address = "$G$17" Then Target.Offset(1, 0).Select
'Protection for row # 18
If Target.Address = "$F$18" Or Target.Address = "$G$18" Then Target.Offset(1, 0).Select
'Protection for row # 19
If Target.Address = "$F$19" Or Target.Address = "$G$19" Then Target.Offset(1, 0).Select
'Protection for row # 20
If Target.Address = "$F$20" Or Target.Address = "$G$20" Then Target.Offset(1, 0).Select
'Protection for row # 21
If Target.Address = "$F$21" Or Target.Address = "$G$21" Then Target.Offset(1, 0).Select
'Protection for row # 22
If Target.Address = "$F$22" Or Target.Address = "$G$22" Then Target.Offset(1, 0).Select
'Protection for row # 23
If Target.Address = "$F$23" Or Target.Address = "$G$23" Then Target.Offset(1, 0).Select
'Protection for row # 24
If Target.Address = "$F$24" Or Target.Address = "$G$24" Then Target.Offset(1, 0).Select
'Protection for row # 25
If Target.Address = "$F$25" Or Target.Address = "$G$25" Then Target.Offset(1, 0).Select
'Protection for row # 26
If Target.Address = "$F$26" Or Target.Address = "$G$26" Then Target.Offset(1, 0).Select
'Protection for row # 27
If Target.Address = "$F$27" Or Target.Address = "$G$27" Then Target.Offset(1, 0).Select
'Protection for row # 28
If Target.Address = "$F$28" Or Target.Address = "$G$28" Then Target.Offset(1, 0).Select
'Protection for row # 29
If Target.Address = "$F$29" Or Target.Address = "$G$29" Then Target.Offset(1, 0).Select
'Protection for row # 30
If Target.Address = "$F$30" Or Target.Address = "$G$30" Then Target.Offset(1, 0).Select
'Protection for row # 31
If Target.Address = "$F$31" Or Target.Address = "$G$31" Then Target.Offset(1, 0).Select
'Protection for row # 32
If Target.Address = "$F$32" Or Target.Address = "$G$32" Then Target.Offset(1, 0).Select
'Protection for row # 33
If Target.Address = "$F$33" Or Target.Address = "$G$33" Then Target.Offset(1, 0).Select
'Protection for row # 34
If Target.Address = "$F$34" Or Target.Address = "$G$34" Then Target.Offset(1, 0).Select
'Protection for row # 35
If Target.Address = "$F$35" Or Target.Address = "$G$35" Then Target.Offset(1, 0).Select
'Protection for row # 36
If Target.Address = "$F$36" Or Target.Address = "$G$36" Then Target.Offset(1, 0).Select
'Protection for row # 37
If Target.Address = "$F$37" Or Target.Address = "$G$37" Then Target.Offset(1, 0).Select
'Protection for row # 38
If Target.Address = "$F$38" Or Target.Address = "$G$38" Then Target.Offset(1, 0).Select
'Protection for row # 39
If Target.Address = "$F$39" Or Target.Address = "$G$39" Then Target.Offset(1, 0).Select
'Protection for row # 40
If Target.Address = "$F$40" Or Target.Address = "$G$40" Then Target.Offset(1, 0).Select
'Protection for row # 41
If Target.Address = "$F$41" Or Target.Address = "$G$41" Then Target.Offset(1, 0).Select
'Protection for row # 42
If Target.Address = "$F$42" Or Target.Address = "$G$42" Then Target.Offset(1, 0).Select
'Protection for row # 43
If Target.Address = "$F$43" Or Target.Address = "$G$43" Then Target.Offset(1, 0).Select
'Protection for row # 44
If Target.Address = "$F$44" Or Target.Address = "$G$44" Then Target.Offset(1, 0).Select
'Protection for row # 45
If Target.Address = "$F$45" Or Target.Address = "$G$45" Then Target.Offset(1, 0).Select
'Protection for row # 46
If Target.Address = "$F$46" Or Target.Address = "$G$46" Then Target.Offset(1, 0).Select
'Protection for row # 47
If Target.Address = "$F$47" Or Target.Address = "$G$47" Then Target.Offset(1, 0).Select
'Protection for row # 48
If Target.Address = "$F$48" Or Target.Address = "$G$48" Then Target.Offset(1, 0).Select
'Protection for row # 49
If Target.Address = "$F$49" Or Target.Address = "$G$49" Then Target.Offset(1, 0).Select
'Protection for row # 50
If Target.Address = "$F$50" Or Target.Address = "$G$50" Then Target.Offset(1, 0).Select
'Protection for row # 51
If Target.Address = "$F$51" Or Target.Address = "$G$51" Then Target.Offset(1, 0).Select
'Protection for row # 52
If Target.Address = "$F$52" Or Target.Address = "$G$52" Then Target.Offset(1, 0).Select
'Protection for row # 53
If Target.Address = "$F$53" Or Target.Address = "$G$53" Then Target.Offset(1, 0).Select
'Protection for row # 54
If Target.Address = "$F$54" Or Target.Address = "$G$54" Then Target.Offset(1, 0).Select
'Protection for row # 55
If Target.Address = "$F$55" Or Target.Address = "$G$55" Then Target.Offset(1, 0).Select
'Protection for row # 56
If Target.Address = "$F$56" Or Target.Address = "$G$56" Then Target.Offset(1, 0).Select
'Protection for row # 57
If Target.Address = "$F$57" Or Target.Address = "$G$57" Then Target.Offset(1, 0).Select
'Protection for row # 58
If Target.Address = "$F$58" Or Target.Address = "$G$58" Then Target.Offset(1, 0).Select
'Protection for row # 59
If Target.Address = "$F$59" Or Target.Address = "$G$59" Then Target.Offset(1, 0).Select
'Protection for row # 60
If Target.Address = "$F$60" Or Target.Address = "$G$60" Then Target.Offset(1, 0).Select
'Protection for row # 61
If Target.Address = "$F$61" Or Target.Address = "$G$61" Then Target.Offset(1, 0).Select
'Protection for row # 62
If Target.Address = "$F$62" Or Target.Address = "$G$62" Then Target.Offset(1, 0).Select
End Sub
Last edited by a moderator: