Thread: magic cell
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Omega Omega is offline
external usenet poster
 
Posts: 15
Default magic cell

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
...