View Single Post
  #15   Report Post  
Dave Peterson
 
Posts: n/a
Default

That was the second one:

If to the right one:
Private Sub ComboBox1_Change()
ActiveCell.Value = Me.ComboBox1.Value
ActiveCell.Offset(0, 1).Activate
End Sub

But I gotta believe that your columns are limited--say B:Z. When you enter data
in B3, go to C3, ..., but when you get to Z3, go to B4????

If that's ok, you could change that sub:

If to the right one:
Private Sub ComboBox1_Change()
ActiveCell.Value = Me.ComboBox1.Value
if activecell.column = range("z1").column then
cells(activcell.row+1,"B").activate
else
ActiveCell.Offset(0, 1).Activate
end if
End Sub

Change z1 to the correct column (the row won't matter).
And change "B" to the first column in the range.



Jan Buckley wrote:

The "next cell" will always be one to the right. Can you write the code for
that? You guys sure are patient with us beginners, and I really appreciate it.

"Dave Peterson" wrote:

If the next cell is down one:

Private Sub ComboBox1_Change()
ActiveCell.Value = Me.ComboBox1.Value
ActiveCell.Offset(1, 0).Activate
End Sub

If to the right one:
Private Sub ComboBox1_Change()
ActiveCell.Value = Me.ComboBox1.Value
ActiveCell.Offset(0, 1).Activate
End Sub

Maybe?????

Jan Buckley wrote:

Dave, this works great, can't tell you how much I've learned during this
little exercise. But is there any way that the user can TAB to the next cell
(after selecting the date from the combo box) rather than having to CLICK
into it? Thanks.

"Jan Buckley" wrote:

JE: That sounds like it would work much better but, not being a programmer, I
don't know how to accomplish it. Can you help?


"JE McGimpsey" wrote:

One way:

For 1 combobox, add this to your worksheet code module (adjust "A1" to
suit):

Private Sub Worksheet_SelectionChange( _
ByVal Target As Range)
ComboBox1.Visible = _
Not (Intersect(Target, Range("A1")) Is Nothing)
End Sub

However, if you've got 500 rows that require comboboxes, I'd consider
rethinking the approach. Perhaps using a single combobox and positioning
it at the appropriate cell whenever one of the cells is selected, then
placing the value of the combobox into the selected cell rather than
hardcoding it.

In article ,
"Jan Buckley" wrote:

I hate to bother you again, but is there a way to "hide" the combo box
until you click or tab into the cell where it resides? I have four columns
(containing up to 500 rows each) on my spreadsheet that will require the
combo boxes and it looks 'ugly' with them all showing. Thanks.


--

Dave Peterson


--

Dave Peterson