Need event macro to tab past a (calculated) cell

J

Jeremy

I have an Excel 2003 List (aka Table in Excel 2007). There are some
protected (calculated) columns that I don't want users to enter data into.
But I can't protect the sheet, because that prevents users from entering a
new record at the bottom of the List.

Does anyone have a suggestion on how to deal with this? I'm thinking of
using an event macro invoked when user tabs out of say column C, which makes
the selection skip the cell in column D and go directly to the cell in
column E. I guess I'd have to use Worksheet.SelectionChange. But I don't
know how to do this..

Any help much appreciated!
 
O

Otto Moehrbach

Jeremy
I don't know much about what you want to do, but the following event
macro will select the cell in Column E whenever a cell in Column D is
selected. Does this help? HTH Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 4 Then
Application.EnableEvents = False
Target.Offset(, 1).Select
Application.EnableEvents = True
End If
End Sub
 
Y

Yngve

Jeremy
    I don't know much about what you want to do, but the following event
macro will select the cell in Column E whenever a cell in Column D is
selected.  Does this help?  HTH  Otto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Target.Column = 4 Then
        Application.EnableEvents = False
            Target.Offset(, 1).Select
        Application.EnableEvents = True
    End If
End Sub








– Vis sitert tekst –

hi jeremy

goto

http://www.erlandsendata.no/english/index.php?d=envbaeventsworksheet

hope that can help you

Regards Yngve
 
J

Jeremy

Many thanks... this is exactly what I needed. What is the purpose of the
first statement "If Target.Count >1 Then Exit Sub"? Does it just make the
routine stop each time a cell change happens?

Jeremy
==================================================
 
O

Otto Moehrbach

No. That simply says to do nothing if a multiple cell selection is made.
HTH Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top