Perfect one. Thank you so much for the effort bro., Could you please explain this section?Try this:
[FONT=lucida console][COLOR=Royalblue]Case[/COLOR] [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] [COLOR=crimson]3[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] [COLOR=crimson]5[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR][/FONT]
[FONT=lucida console] [COLOR=Royalblue]Select[/COLOR] [COLOR=Royalblue]Case[/COLOR] Target
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"A1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"C1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"E1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Select[/COLOR][/FONT]
The above code doesn't work. sometimes It replace value 1 in G1. I replaced the code and saved file then closed, reopened and start typing A1 value and changed value in C1 then it seems it replace G1 to 1Target.Column is the column number of "Target" (the cell you're selecting). So if you select A1 it means Target.Column = 1, while selecting C1 means Target.Column = 3. So 'Case 1' mean if you select column 1 (col A).
So if you select A1 and you want to change value C1 & E1 then we use Offset.
Case 1
Target.Offset(0, 2) = 1 'means from A1 move 2 column to the right, i.e C1
If you don't want use column as reference you can just use the range, like this:
Code:[FONT=lucida console] [COLOR=Royalblue]Select[/COLOR] [COLOR=Royalblue]Case[/COLOR] Target [COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"A1"[/COLOR]) Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR] Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"C1"[/COLOR]) Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR] Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"E1"[/COLOR]) Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR] Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Select[/COLOR][/FONT]
The above code doesn't work. sometimes It replace value 1 in G1. I replaced the code and saved file then closed, reopened and start typing A1 value and changed value in C1 then it seems it replace G1 to 1
[FONT=lucida console][COLOR=Royalblue]Private[/COLOR] [COLOR=Royalblue]Sub[/COLOR] Worksheet_Change([COLOR=Royalblue]ByVal[/COLOR] Target [COLOR=Royalblue]As[/COLOR] Range)
[COLOR=Royalblue]If[/COLOR] [COLOR=Royalblue]Not[/COLOR] Intersect(Target, Range([COLOR=brown]"A1,C1,E1"[/COLOR])) [COLOR=Royalblue]Is[/COLOR] [COLOR=Royalblue]Nothing[/COLOR] [COLOR=Royalblue]Then[/COLOR]
[COLOR=Royalblue]If[/COLOR] Target.Cells.Count = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]And[/COLOR] Target.Value > [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]Then[/COLOR]
Application.EnableEvents = [COLOR=Royalblue]False[/COLOR]
[COLOR=Royalblue]Select[/COLOR] [COLOR=Royalblue]Case[/COLOR] Target
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"A1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"C1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] Range([COLOR=brown]"E1"[/COLOR])
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Select[/COLOR]
Application.EnableEvents = [COLOR=Royalblue]True[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Sub[/COLOR][/FONT]
[FONT=lucida console][COLOR=Royalblue]Private[/COLOR] [COLOR=Royalblue]Sub[/COLOR] Worksheet_Change([COLOR=Royalblue]ByVal[/COLOR] Target [COLOR=Royalblue]As[/COLOR] Range)
[COLOR=Royalblue]If[/COLOR] [COLOR=Royalblue]Not[/COLOR] Intersect(Target, Range([COLOR=brown]"A1,C1,E1"[/COLOR])) [COLOR=Royalblue]Is[/COLOR] [COLOR=Royalblue]Nothing[/COLOR] [COLOR=Royalblue]Then[/COLOR]
[COLOR=Royalblue]If[/COLOR] Target.Cells.Count = [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]And[/COLOR] Target.Value > [COLOR=crimson]1[/COLOR] [COLOR=Royalblue]Then[/COLOR]
Application.EnableEvents = [COLOR=Royalblue]False[/COLOR]
[COLOR=Royalblue]Select[/COLOR] [COLOR=Royalblue]Case[/COLOR] Target.Address
[COLOR=Royalblue]Case[/COLOR] [COLOR=brown]"$A$1"[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] [COLOR=brown]"$C$1"[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], [COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]Case[/COLOR] [COLOR=brown]"$E$1"[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]4[/COLOR]) = [COLOR=crimson]1[/COLOR]
Target.Offset([COLOR=crimson]0[/COLOR], -[COLOR=crimson]2[/COLOR]) = [COLOR=crimson]1[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Select[/COLOR]
Application.EnableEvents = [COLOR=Royalblue]True[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]If[/COLOR]
[COLOR=Royalblue]End[/COLOR] [COLOR=Royalblue]Sub[/COLOR][/FONT]
It's not possible to treat a cell as Input and Output Cell at the same time.... In Excel it's not possible. But I am sure, it can be done with the help of VBA.