Looping on Cells $x$y (continued)
My apologies. This is exactly what I want to do. The users can select
various cells and depending on which cells are selected routines will be
executed (i.e. if "$A$1" selected by user "do stuff", if "$A$5" selected "do
same stuff that was done when A1 was selected", if "$B$1" selected "do new
stuff" and if "$B$5" selected "do same new stuff that was done when B1 was
selected".
So I am currently replicating code and changing the cells numbers. I think
I am way off base.
Private Sub Worksheet_SelectionChange (Target....)
Select Target.Address
Case "$A$1", "$A$5"...
Do X
Case "$B$1", "$B$5"
Do Y
End Case
End Sub
I was hoping to loop through without the extremely long Case statment line
with exact cells. I hope this clarifies what I was trying to do. Is looping
possible? Thank you.
D.Parker
"Tom Ogilvy" wrote:
Cells(i,j).Address(True,True)
will produce the address for the cell at row i and column j in the form $A$1
But there may be a better way to do what you are trying to do -- however you
haven't said what that is.
--
Regards,
Tom Ogilvy
"D.Parker" wrote in message
...
I have an worksheet with a Case structure for performing centain events is
a
certain cell is selected:
Select Case Target.Address
Case "$B$4"
If ....Then....End If
End Select
So, now I would like to increment to, lets say to cell B5. Is there a way
can set up the following, unfortunately it did not work for me so I
assumed
it was not possibe or better yet I was doing something wrong?:
Instead of Case "$B$4" can I use Case "$i$j" to loop through various
cells?
Thank you.
D. Parker
|