Copy manually (Ctrl + C) COMBOBOX

ZTK

Board Regular
Joined
Aug 20, 2021
Messages
51
Office Version
  1. 2019
Platform
  1. Windows
I ask for your valuable knowledge, I have a drop-down list macro that they supported me right here in the forum, it is almost perfect for my needs, the fact is that I need to copy the content of the cell of the text applied by the COMBOBOX that contains it manually (CTRL + C) to another file or document.

The detail is that when selecting the COMBOBOX cell, it makes Dropdown automatically and does not allow copying ...

Is there a way to avoid this? For example, the list is displayed ONLY IF THE UP or DOWN ARROW KEY IS PRESSED?

I hope you understand me.

Thanks in advance



Attached file for reference




 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
If you want to switch to down-arrow functionality to activate the combo box, something like this might be workable.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ComboBox1.Visible = True Then ComboBox1.Visible = False

    If isValid(Target.Offset(-1)) Then   'dn arrow approximation
        vList = Empty
        On Error GoTo skip

        Target.Offset(-1).Activate
        Set xRange = Evaluate(ActiveCell.Validation.Formula1)
        Call toShowCombobox
    End If
    Exit Sub
skip:
    If ComboBox1.Visible = True Then ComboBox1.Visible = False
End Sub
 
  • Like
Reactions: ZTK
Upvote 0
If you want to switch to down-arrow functionality to activate the combo box, something like this might be workable.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ComboBox1.Visible = True Then ComboBox1.Visible = False

    If isValid(Target.Offset(-1)) Then   'dn arrow approximation
        vList = Empty
        On Error GoTo skip

        Target.Offset(-1).Activate
        Set xRange = Evaluate(ActiveCell.Validation.Formula1)
        Call toShowCombobox
    End If
    Exit Sub
skip:
    If ComboBox1.Visible = True Then ComboBox1.Visible = False
End Sub
It seems to work excellent

One last favor, can this option be combined so that the combobox is also activated when the search is done in it? that begins to show the list with the words that are coinciding?
 
Upvote 0
Sorry, I don't have any ideas for that.
 
  • Like
Reactions: ZTK
Upvote 0
Sorry, I don't have any ideas for that.
Don't worry, it will be a matter of adapting

Another query: when adding more cells with COMBOBOX below the ones that already exist, only the top list remains selected, the bottom ones do not have the same function

Can it be solved so that the other lists below also work the same?

Thank you again
 
Upvote 0
Is there a way to avoid this? For example, the list is displayed ONLY IF THE UP or DOWN ARROW KEY IS PRESSED?
Here's an example, but I'm using ALT+Right to activate the combobox.
To change the shortcut key, change the value in this part:
In module1:
'shortcut key to show the combobox:
Public Const xdvKey As String = "%{RIGHT}"

Read sheet INFO on how to apply the code on your workbook.
Sample workbook:

and applied on your workbook:
 
  • Like
Reactions: ZTK
Upvote 0
Here's an example, but I'm using ALT+Right to activate the combobox.
To change the shortcut key, change the value in this part:
In module1:
'shortcut key to show the combobox:
Public Const xdvKey As String = "%{RIGHT}"

Read sheet INFO on how to apply the code on your workbook.
Sample workbook:

and applied on your workbook:
Thank you very much for the help

I will make the change in my file
 
Upvote 0
Here's an example, but I'm using ALT+Right to activate the combobox.
To change the shortcut key, change the value in this part:
In module1:
'shortcut key to show the combobox:
Public Const xdvKey As String = "%{RIGHT}"

Read sheet INFO on how to apply the code on your workbook.
Sample workbook:

and applied on your workbook:
Good day; again causing discomfort (I hope it is the last).

I realize that the macro doesn't work if I add a new sheet with any name (other than 00).

I already tried to modify the part of the code with something like "Activesheet" but I can't get it to work.

Could you support me again @Akuini ?

Thank you again in advance for your help
 
Upvote 0
I realize that the macro doesn't work if I add a new sheet with any name (other than 00).
Do you mean you want to apply the searchable combobox in multiple sheets?
Can you upload your workbook?
In the code you need to adjust variable shN according to the new sheet name, in this part:
'=============== ADJUST THE CODE IN THIS PART: ===================================

'this sheet's name (sheet where the data validation is located). [in the sample: sheet "Sheet1"]
Private Const shN As String = "00"


Note:
Another way:
I created an add-in called “Search deList”, and I shared it as a freeware, and also the code is not protected so you can check it & amend it as needed.
Its function is to speed up searching in data validation list. In any cell that has data validation (with List type) pressing ALT+RIGHT will open a Userform with a combobox. You can type multiple keywords (separated by a space) in the combobox and the list will be narrowed down as you type.
You can use up-down arrow to select an item, then hit ENTER, the selected item will be inserted into the cell, and the Userform will be closed.
And also you don't need vba.
I posted the add-in in this thread: LINK

OR

If you don't want to install the add-in, there's another option, which is using vba. See in this thread: LINK
 
  • Like
Reactions: ZTK
Upvote 0
Do you mean you want to apply the searchable combobox in multiple sheets?
Can you upload your workbook?
In the code you need to adjust variable shN according to the new sheet name, in this part:
'=============== ADJUST THE CODE IN THIS PART: ===================================

'this sheet's name (sheet where the data validation is located). [in the sample: sheet "Sheet1"]
Private Const shN As String = "00"


Note:
Another way:
I created an add-in called “Search deList”, and I shared it as a freeware, and also the code is not protected so you can check it & amend it as needed.
Its function is to speed up searching in data validation list. In any cell that has data validation (with List type) pressing ALT+RIGHT will open a Userform with a combobox. You can type multiple keywords (separated by a space) in the combobox and the list will be narrowed down as you type.
You can use up-down arrow to select an item, then hit ENTER, the selected item will be inserted into the cell, and the Userform will be closed.
And also you don't need vba.
I posted the add-in in this thread: LINK

OR

If you don't want to install the add-in, there's another option, which is using vba. See in this thread: LINK


Like always, thank you...

Due to the workload, I have not been able to check the modification in detail.

The detail of my file is that sheets with random names are added daily, that is why the macro that I have as the final one does not work very well.

Is there a way that it doesn't matter the name of the sheet and still does exactly what is already in the code?

And anyway, since I use the format in my work, we are not allowed to install the add-on it shared (which would be a good solution)
 
Upvote 0

Forum statistics

Threads
1,214,800
Messages
6,121,641
Members
449,044
Latest member
hherna01

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