ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active cell is to jump from one cell to another when conditions are met (https://www.excelbanter.com/excel-programming/444139-active-cell-jump-one-cell-another-when-conditions-met.html)

Michael Lanier

Active cell is to jump from one cell to another when conditions are met
 
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.

James Ravenswood

Active cell is to jump from one cell to another when conditionsare met
 
On Jan 20, 10:44*am, Michael Lanier wrote:
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

Michael Lanier

Active cell is to jump from one cell to another when conditionsare met
 
James,

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

Michael


All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com