View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Jump to next cell after selecting from drop down list

Sandie
Now we're going somewhere. To make this as simple as possible, use a
named list for the DV cell. By this I mean find some place on that sheet or
on another sheet to type in the list. You may already have all this but
just in case you don't, let's do it this way. Name that range (the range of
the list) some name than means something to you. I'll use "TheList" for
now. You can change that in the code as you wish.
When you setup the DV cell, under "Allow:", select "List". Under
"Source" type "=TheList" without the quotes.
Paste this macro in the sheet module of your sheet. To do that, right-click
on the sheet tab, select View Code, and paste this macro into that module.
"X" out of the module to return to your sheet. As written this macro will
fire when the contents of any cell in Column B is changed. The cell that
changed is referred to, in the macro, as the Target cell. If the cell below
the Target cell is empty, the macro will do nothing. Otherwise, the macro
will insert a new blank row below the row of the Target cell, and setup a DV
in the cell below the Target cell. You didn't mention this, but I think you
want the new DV cell selected, so I wrote that into the code also. Try this
out and see what it does. Please post back if you want something changed or
you need more help. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
If Not IsEmpty(Target.Offset(1).Value) Then
Application.EnableEvents = False
Target.Offset(1).EntireRow.Insert
With Target.Offset(1).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=TheList"
End With
Application.EnableEvents = True
Target.Offset(1).Select
End If
End If
End Sub

"Sandie" wrote in message
...
Hi Otto:

Actually, you hit it right on the nose! If cell B6 is empty, I would like
for the DV to stop. But if there is a value in B6, I would like for an
empty
row to be inserted with the same DV list as previous.

Make sense? I appreciate your help !

"Otto Moehrbach" wrote:

Sandie
I know that what you are saying makes perfectly good sense to you,
but
for someone who has no knowledge whatsoever of your business, it doesn't
flow smoothly.
Here's what I get from what you say:
You have a Data Validation (DV) cell in B5.
You select something in B5.
If B6 is occupied, you want a new blank row inserted below B5 and a DV
cell
with the same list created in the new blank B6.
Is this correct?
I will, for now, assume it is correct.
What do you want to happen if B6 is empty?
Do you want this pattern to go on forever or is there some threshold
beyond
which you don't want to go?
From what I get from what you say, you will end up with a bunch of DV
cells.
Maybe just a few if there is something to stop the pattern. Will you
want
some or most or all but one DV cells removed (remove the DV feature from
the
cell) at some point. If so, what point? HTH Otto
"Sandie" wrote in message
...
Thanks for the response Otto.

What I meant is...for example: if in cell B5 there is a drop down menu
to
select from. I want to be able to select from that drop down in B5,
then
have cell B6 automatically come up as another cell that I can select
from
the
same pull down menu as B5. I would like for this to occur when there
is
an
entry already in B6. So, essentially I want to create another row to
select
from the pull down menu if there is already an entry in that next row,.
May
be if I explain what I mean..

I have a timesheet that I am working on. But for a single day, I may be
able
to charge several job codes, however, the number of job codes that I
can
enter per day may vary, depending on the work that needs to be done.

So for example:
Monday 11/06/06: Administrative 2.0 hours, Customer 6.0 hours
Tuesday 11/07/06: Adminsitrative 3.0 hours, Customer 3.0 hours, Company
2.0
hours


"Otto Moehrbach" wrote:

Sandie
What you say is a little confusing. When you say "the next row",
do
you
mean the next item in the pull down menu, or the row below the row
that
has
the pull down menu?
In other words, if the pull down cell is, say, B5, when you click on
an
item
in the pull down menu, do you want the active cell to be B6?
If this is what you want, it will require a small VBA macro.
Please post back and clarify what you want. HTH Otto
"Sandie" wrote in message
...
Does anyone know how I can setup a pull down menu, select an item
from
that
pull down menu, and have Excel automatically go to the next row?
AND,
if
there is a value already in that next row, how can I have Excel
automatically
enter a new row so that I can continue selecting from the pull down?

Thank you!!