I have this code
The complete Range of cells I have is over a few hundred. They are: A1:A338,D4,F4,H4,D5,F5,D6,F6,H6,J6,D7,F7,D9,F9,D25,F25,H25,D26,F26,D30,F30,D41,F41,H41,D54,F54,H54,D59,F59,D69,F69,H69,D84,F84,D116,F116,H116,J116,D120,F120,H120,J120,D124,F124,H124,J124,D125,F125,D127,F127,H127,J127,D133,F133,H133,D135,F135,D140,F140,H140,J140,D142,F142,H142,D145,F145,D147,F147,H147,J147,D149,F149,D154,F154,H154,J154,D156,F156,D163,F163,D165,F165,D167,F167,D169,F169,H169,J169,D170,F170,D172,F172,D174,F174,D180,F180,H180,J180,D181,F181,H181,J181,D182,F182,H182,J182,D183,F183,H183,J183,D184,F184,H184,J184,D186,F186,H186,D187,F187,H187,D188,F188,H188,D189,F189,H189,D190,F190,H190,D191,F191,H191,D193,F193,H193,D194,F194,H194,D195,F195,H195,D196,F196,H196,D197,F197,H197,D198,F198,H198,D199,F199,H199,D200,F200,H200,D201,F201,H201,D202,F202,H202,D203,F203,H203,D204,F204,H204,D205,F205,H205,D206,F206,H206,D208,F208,H208,D209,F209,H209,D210,F210,H210,D211,F211,H211,D212,F212,H212,D215,F215,H215,D218,F218,D219,F219,D220,F220,D228,F228,H228,D230,D231,D232,D233,D234,D235,D236,D237,D238,D240,D241,D242,D243,D245,F245,D251,F251,D255,B257,B258,B260,B261,B262,B263,B264,B265,B266,B267,B268,B269,B270,B271,B272,B273,B274,B275,B276
When I paste them into the code it is over multiple lines and I get a compile error.
How do I do this? And is there a better way to do what I am doing?
Appologize for my ignorance.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
'This code puts a "g" in the cells that are cliked on
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A1:A338,D4,F4,H4,D5,F5,D6,F6,H6,J6,D7,F7,D9,F9")) Is Nothing Then
If Target = "c" Then
Target = "g"
Else
Target = "c"
End If
End If
End Sub
The complete Range of cells I have is over a few hundred. They are: A1:A338,D4,F4,H4,D5,F5,D6,F6,H6,J6,D7,F7,D9,F9,D25,F25,H25,D26,F26,D30,F30,D41,F41,H41,D54,F54,H54,D59,F59,D69,F69,H69,D84,F84,D116,F116,H116,J116,D120,F120,H120,J120,D124,F124,H124,J124,D125,F125,D127,F127,H127,J127,D133,F133,H133,D135,F135,D140,F140,H140,J140,D142,F142,H142,D145,F145,D147,F147,H147,J147,D149,F149,D154,F154,H154,J154,D156,F156,D163,F163,D165,F165,D167,F167,D169,F169,H169,J169,D170,F170,D172,F172,D174,F174,D180,F180,H180,J180,D181,F181,H181,J181,D182,F182,H182,J182,D183,F183,H183,J183,D184,F184,H184,J184,D186,F186,H186,D187,F187,H187,D188,F188,H188,D189,F189,H189,D190,F190,H190,D191,F191,H191,D193,F193,H193,D194,F194,H194,D195,F195,H195,D196,F196,H196,D197,F197,H197,D198,F198,H198,D199,F199,H199,D200,F200,H200,D201,F201,H201,D202,F202,H202,D203,F203,H203,D204,F204,H204,D205,F205,H205,D206,F206,H206,D208,F208,H208,D209,F209,H209,D210,F210,H210,D211,F211,H211,D212,F212,H212,D215,F215,H215,D218,F218,D219,F219,D220,F220,D228,F228,H228,D230,D231,D232,D233,D234,D235,D236,D237,D238,D240,D241,D242,D243,D245,F245,D251,F251,D255,B257,B258,B260,B261,B262,B263,B264,B265,B266,B267,B268,B269,B270,B271,B272,B273,B274,B275,B276
When I paste them into the code it is over multiple lines and I get a compile error.
How do I do this? And is there a better way to do what I am doing?
Appologize for my ignorance.