Mick17
Mick17

Reputation: 196

excel not responding after closing Find menu that is opened with vba

I have created a button in a excel sheet that opens the Find menu (ctrl+f).

Sub Button6_Click()

Application.Dialogs(xlDialogFormulaFind).Show

End Sub

After the search is done and one closes this menu excel doesn't respond anymore and closes itself. Any ideas why?

Also, I don't get the exact same find dialog as when I use ctrl+f. Is there maybe a way to use keyboard-functions in vba?

Why not use ctrl+f instead of the button. Because my colleagues are not quite good with excel and that already is too much to remember for them :)

Upvotes: 1

Views: 50

Answers (1)

Glitch_Doctor
Glitch_Doctor

Reputation: 3034

This is how to mimic a key press in VBA ^ is Ctrl

Sub Button6_Click()

Application.SendKeys ("^f")

End Sub

Upvotes: 1

Related Questions