Working code needs attention

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Morning all,
I have the working code supplied below.

How it works is i make a selection from the combobox & that person in question has its row highlighted & the cell in column A which is customers name is then selected.

What i would like to do now at this point is when i hit enter the userform opens & that customers entry is then shown.

The userform is called Database

If it helps when the userform opens the customers name is in the textbox called txtCustomer

Code:
Private Sub combobox1_Change()  Dim r As Range
  Set r = Range("A5", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible) _
    .Find(ComboBox1.Value)
  If Not r Is Nothing Then r.Select
  ComboBox1.ListIndex = -1
End Sub

Many thanks & have a nice Sunday.
 
Hmmm,
Well maybe it will need to be my original request.
You you advise please the code for the following to work.
If a cell in column A is selected when i het enter show the userform which is called Database.
This is what i wanted at the start but got side tracked.

Not sure how to write it but something like.
If cell A "then range say 1-infinity" = vbKeyReturn Then Database.Show
Thanks
 
Last edited:
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I thought the following code would open my userform but it still drops down a row each time enter is pressed as opposed to opening my form ??

Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If Range("A6:A200") = vbKeyReturn Then
    Database.Show
    End If
End Sub
 
Upvote 0
I thought the following code would open my userform but it still drops down a row each time enter is pressed as opposed to opening my form ??

Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If Range("A6:A200") = vbKeyReturn Then
    Database.Show
    End If
End Sub
I have no expetise in that area of coding. Sorry.
Regards, JLG
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top