Active cell is to jump from one cell to another when conditions are met


M

Michael Lanier

I have a register that when an entry is made in column B but there is
no entry in column C, the active cell will jump from B to C. Other
columns exist and will require their own sets of conditions. The
problem I have is in the need for a simple formula that will allow for
as many as 1,660 rows. The following shows what I've attempted
without success. Can you offer a solution? Thanks.

If Range("B10:B1660").Value > 0 And Range("C10:C1660").Value = ""
Then
With Me
Application.GoTo Range("C10:C1660"), Scroll:=False
End With
End If

A separate issue would be when all the entries in a row have been
entered, the active cell will jump to the next row awaiting it's
initial entry, however, my first problem is far more pressing.
 
Ad

Advertisements

J

James Ravenswood

I have a register that when an entry is made in column B but there is
no entry in column C, the active cell will jump from B to C.  Other
columns exist and will require their own sets of conditions.  The
problem I have is in the need for a simple formula that will allow for
as many as 1,660 rows.  The following shows what I've attempted
without success.  Can you offer a solution?  Thanks.

    If Range("B10:B1660").Value > 0 And Range("C10:C1660").Value = ""
Then
        With Me
            Application.GoTo Range("C10:C1660"), Scroll:=False
        End With
    End If

A separate issue would be when all the entries in a row have been
entered, the active cell will jump to the next row awaiting it's
initial entry, however, my first problem is far more pressing.

Try this tiny event macro:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range, B As Range
Set t = Target
Set B = Range("B10:B1660")
If Intersect(t, B) Is Nothing Then Exit Sub
If t.Offset(0, 1) <> "" Then Exit Sub
t.Offset(0, 1).Select
End Sub


Because it is worksheet code, it is very easy to install and automatic
to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
Ad

Advertisements

M

Michael Lanier

James,

With great anticipation I look forward to trying this one. Thanks so
very much for your help.

Michael
 

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