Return to combobox after running marco

KlausW

Active Member
Joined
Sep 9, 2020
Messages
378
Office Version
  1. 2016
Platform
  1. Windows
Hi, anyone who can help. I use a combobox to search and find items. I transfer them with a VBA code, when I run it the combobox is emptied as it should be. Now I would like the cursor to be in the combobox after the VBA code has been run. Some who can help.

Sincerely Klaus W

VBA Code:
Sub GoToCell() Worksheets("Prisliste").Range("R4").Select Than Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You did not say where the Combobox was located. For ComboBox1:
VBA Code:
'For a Form try
Me.ComboBox1.SetFocus

'For a Worksheet try
ActiveSheet.ComboBox1.Activate
 
Upvote 0
Hi igold
The combobox is located in the sheet Prisliste.
Is that, what you mean?
 

Attachments

  • Combobox.jpg
    Combobox.jpg
    79.4 KB · Views: 4
Upvote 0
Yes. Try the second line of the posted code.

VBA Code:
Worksheets("Prisliste").ComboBox1.Activate
 
Upvote 0
Solution
I am sorry but it still not return to the Combobox.
VBA Code:
Sub GoToCell()

'For a Form try
Me.ComboBox1.SetFocus

'For a Worksheet try

Worksheets("Prisliste").ComboBox1.Activate

End Sub
 
Upvote 0
It worked on my test sheet with a ComboBox named ComboBox1. What is the name of your Combobox?
 
Upvote 0
You're welcome. Thanks for the feedback.
 
Upvote 0
I I just have to remove this line
Me.ComboBox1.SetFocus
Thanks
 
Upvote 0

Forum statistics

Threads
1,214,986
Messages
6,122,611
Members
449,090
Latest member
vivek chauhan

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