Thread: magic cell
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default magic cell


Rick, I couldn't figure it out either. That's why I posted the way I did
Private Sub Worksheet_SelectionChange _
(ByVal Target As Range)
If Target.Row < 4 Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, Target.Column). _
Offset(, 21).Resize(552).Select

MsgBox "Click OK to go back to " & Target.Address
Target.Select

Application.EnableEvents = True
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rick Rothstein" wrote in message
...
What is it you think these 5 lines of code (actually, I only see 4 lines
of code) you posted are doing??? All I see them doing is re-selecting the
cell you just selected.

--
Rick (MVP - Excel)


"omega" wrote in message
...
Don Guillett,

Wow! As per your advice, I edit out some lines and with some trial and
error, I have reached the desired result. Amazingly, just five lines of
the
code you gave replaced my bulky codes before.

Below is the edited version of the code that works perfectly for my
project:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, Target.Column).Offset(, 26).Select
Target.Select
Application.EnableEvents = True
End Sub

Thank you very much!

Omega

================================================== ====

"Don Guillett" wrote:

I can't quite figure out what you want but if you select row 4 in any
column
it will select that column offset 21 from row 4 to row 555. So,
selecting
h4 will select ac4:ac555. If you want this to happen from any cell in
col H,
just comment out or delete the if row line

Private Sub Worksheet_SelectionChange _
(ByVal Target As Range)
If Target.Row < 4 Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, Target.Column). _
Offset(, 21).Resize(552).Select

MsgBox "Click OK to go back to " & Target.Address
Target.Select

Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"omega" wrote in message
...