J
jasonsweeney
On a worksheet, I have a whole series of related commands that launc
when the user clicks in one of four ranges of cells. WHat thos
commands are is unimportant. Suffice to say each set of VBA code fo
each of the four ranges of cells is a long series of code.
Right now, I have all four sections in one large module. I want t
create a separate sub-routine for each of the four sections, but
don't know how to do it (all efforts result in error).
The catch is that all of the commands stem from the user clicking in
given cell. Thus the sub starts with:
________
Private Sub Worksheet_SelectionChange(ByVal target As Range)
[Long code regarding range 1 of cells]
[Long code regarding range 2 of cells]
[Long code regarding range 3 of cells]
[Long code regarding range 4 of cells]
End sub
____________
What I want is the following:
________
Private Sub Worksheet_SelectionChange(ByVal target As Range)
[If user selects one cell in the range A1:A50 then call sub1]
[If user selects one cell in the range B1:B50 then call sub2]
[If user selects one cell in the range C1:CA50 then call sub3]
[If user selects one cell in the range D150 then call sub4]
End sub
____________
Suggestions??
when the user clicks in one of four ranges of cells. WHat thos
commands are is unimportant. Suffice to say each set of VBA code fo
each of the four ranges of cells is a long series of code.
Right now, I have all four sections in one large module. I want t
create a separate sub-routine for each of the four sections, but
don't know how to do it (all efforts result in error).
The catch is that all of the commands stem from the user clicking in
given cell. Thus the sub starts with:
________
Private Sub Worksheet_SelectionChange(ByVal target As Range)
[Long code regarding range 1 of cells]
[Long code regarding range 2 of cells]
[Long code regarding range 3 of cells]
[Long code regarding range 4 of cells]
End sub
____________
What I want is the following:
________
Private Sub Worksheet_SelectionChange(ByVal target As Range)
[If user selects one cell in the range A1:A50 then call sub1]
[If user selects one cell in the range B1:B50 then call sub2]
[If user selects one cell in the range C1:CA50 then call sub3]
[If user selects one cell in the range D150 then call sub4]
End sub
____________
Suggestions??