O
omega
Hi, I’m a newbie. I encountered a code in this site and I tweaked it to
attain my goal but there is a limitation to this code and I want to modify it
further.
This is written in Sheet1:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("H4").Address Then
DisplayFarCell_AA
End If
If Target.Address = Range("I4").Address Then
DisplayFarCell_AB
End If
End Sub
This is written in Module1:
Sub DisplayFarCell_AA()
Range("AA4").Select
Range("H4").Select
End Sub
Sub DisplayFarCell_AB()
Range("AB4").Select
Range("I4").Select
End Sub
The sheet has its “freeze pane†at cell O7. When you select cell H4, cell
AA4 will automatically display at the right side of the screen, then the
cursor goes back to H4.
As you know, this is only limited to cell H4. My goal is to watch an active
cell, column per column. Instead of just watching “H4†to be selected, I want
to watch H4 to H555 and I4 to I555 and so on.
Quick explanation of the goal:
Watch columns, ranges H4:H555, I4:I555, J4:J555, K4:H555
If one cell in range H4:H555 is selected,
then display AA4 (column AA),
then go back to selected cell.
If one cell in range I4:I555 is selected,
then display AB4 (column AB),
then go back to selected cell.
If one cell in range J4:J555 is selected,
then display AC4 (column AC),
then go back to selected cell.
If one cell in range K4:H555 is selected,
then display AD4 (column AD),
then go back to selected cell.
Note: Instead of displaying a cell, I may want to display a chart. It would
then be like this:
If one cell in range H4:H555 is selected,
then display CHART1
then go back to selected cell.
If another cell is but still in range H4:H555
then still display CHART1
then go back to selected cell.
If another cell is but in another range -- I4:I555
then hide CHART1 then display CHART2
then go back to selected cell.
Thank you so much for your help. I am using excel 2007.
attain my goal but there is a limitation to this code and I want to modify it
further.
This is written in Sheet1:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("H4").Address Then
DisplayFarCell_AA
End If
If Target.Address = Range("I4").Address Then
DisplayFarCell_AB
End If
End Sub
This is written in Module1:
Sub DisplayFarCell_AA()
Range("AA4").Select
Range("H4").Select
End Sub
Sub DisplayFarCell_AB()
Range("AB4").Select
Range("I4").Select
End Sub
The sheet has its “freeze pane†at cell O7. When you select cell H4, cell
AA4 will automatically display at the right side of the screen, then the
cursor goes back to H4.
As you know, this is only limited to cell H4. My goal is to watch an active
cell, column per column. Instead of just watching “H4†to be selected, I want
to watch H4 to H555 and I4 to I555 and so on.
Quick explanation of the goal:
Watch columns, ranges H4:H555, I4:I555, J4:J555, K4:H555
If one cell in range H4:H555 is selected,
then display AA4 (column AA),
then go back to selected cell.
If one cell in range I4:I555 is selected,
then display AB4 (column AB),
then go back to selected cell.
If one cell in range J4:J555 is selected,
then display AC4 (column AC),
then go back to selected cell.
If one cell in range K4:H555 is selected,
then display AD4 (column AD),
then go back to selected cell.
Note: Instead of displaying a cell, I may want to display a chart. It would
then be like this:
If one cell in range H4:H555 is selected,
then display CHART1
then go back to selected cell.
If another cell is but still in range H4:H555
then still display CHART1
then go back to selected cell.
If another cell is but in another range -- I4:I555
then hide CHART1 then display CHART2
then go back to selected cell.
Thank you so much for your help. I am using excel 2007.