+ Reply to Thread
Results 1 to 2 of 2

Tabbing out of Blank Cell

  1. #1
    Jamie
    Guest

    Tabbing out of Blank Cell

    I'm working in Excel 2002

    I have a table with 18 columns where the user enters numeric values. The
    sheet is proctected, the cells the user inputs information into are unlocked.
    Currently I have the following coding:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 18 Then
    Cells(Target.Row, 1).Select
    End If
    End Sub

    What this does is if the user tabs out of column 18, row 3 for example, the
    cursor goes to column A in the same row.

    The above coding works only if there is a numeric value in the cell in
    column 18. How can I get the above coding to work if the user leaves the
    cell blank?

    Thanks.

    --
    Jamie

  2. #2
    Gord Dibben
    Guest

    Re: Tabbing out of Blank Cell

    Jamie

    Use selection_change

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 18 Then
    Cells(Target.Row, 1).Select
    End If
    End Sub

    Why go back to column A in the same row? Wouldn't you want to drop down one
    row for entering the next set of data?

    If that were the case, you would not need event code, just TAB out of column
    18 and you will go to column A 1 row down.

    Assuming all other columns are locked, of course.


    Gord Dibben Excel MVP

    On Fri, 1 Apr 2005 16:19:03 -0800, "Jamie" <Jamie@discussions.microsoft.com>
    wrote:

    >I'm working in Excel 2002
    >
    >I have a table with 18 columns where the user enters numeric values. The
    >sheet is proctected, the cells the user inputs information into are unlocked.
    > Currently I have the following coding:
    >
    >Private Sub Worksheet_Change(ByVal Target As Range)
    > If Target.Column = 18 Then
    > Cells(Target.Row, 1).Select
    > End If
    >End Sub
    >
    >What this does is if the user tabs out of column 18, row 3 for example, the
    >cursor goes to column A in the same row.
    >
    >The above coding works only if there is a numeric value in the cell in
    >column 18. How can I get the above coding to work if the user leaves the
    >cell blank?
    >
    >Thanks.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1