Short Macro to auto load a CTRL Shortcut

I'm trying to make a worksheet very simple for someone who doesn't know Excel.  So I want to program a function like "FIND" into a macro and then place a button on the worksheet where when pressed, up comes the FIND capability.

Here's what I tried to do;
Macro2()
Application.OnKey "^{+}F"
End Sub

But it doesn't work.

Any help would be appreciated.

B.
Bright01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

duncanb7Commented:
I tried the example please view the attachement of functionkey.xls
In the inputbox, type the search string such as "Joe" the "find"
action will react and the cell is selected
the sharp functionkey will call functionkey() when you click on it.



Why you mentions  "^{+}F", you want to hit ^+F instead of the mouse right ?

Duncan
functionkey.xls
0
duncanb7Commented:
Please see the new attachement file
with  the following code,

Private Sub Workbook_Activate()
    Application.OnKey "+^{F}", "functionkey"
End Sub

Open in new window


Now I know what you want

Ducan
functionkey.xls
0
duncanb7Commented:
I put the sub of  Workbook_Activate
at THisWorkbook sheet that will be run  automatically
when the file is re-open. The ctrl-F key will
activate to wait for user to press and call
the function of functionkey()

Duncan
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

duncanb7Commented:
So now you can click sharp by right-click or cltr-F to call
macro of functionkey(). ANd the inputbox will show up
and type "Joe" search text , and th function will find the
cell location.

Hope understand your question completely.If not, please point it out

Duncan
0
duncanb7Commented:
Please take a look  the new attachment for reference only

Duncan
functionkey.xls
0
Bright01Author Commented:
Duncan,

Made the changes.  One last thing.... and I promise this isn't "scope creep"..... If I find a name, and then am below the next name I try to find, the macro doesn't start at the top again.  It starts where the active cell is.  So if "Fed Ex" is what I'm looking for, and I'm on the cell for "Ford", it can't find it because it is "above" the Ford cell/record.

Is there a line of code that makes it start from the top of the column every time you do a Find?

B.
0
duncanb7Commented:
Do you think summarize what the last issue you have on the new thread that will be easier
for other experts to look into it ?


Duncan
0
Bright01Author Commented:
Normally I would say so; but I think we are talking about "tweeks" here.   Here are the two outstanding issues;

1.) The find function needs to start at the top every time it is used.
2.) Case should not matter.

If I need to author another question, I'm going to have to get someone up to speed on the great work you have already done.  The question has been authored twice already and you're running both results.

Make sense?

B.
0
duncanb7Commented:
Yes.

Duncan
0
Glenn RayExcel VBA DeveloperCommented:
Bright01,

It appears you have a specialized application already going on with Duncan, but if you truly want to emulate the [Ctrl]+[F] action of calling up the Find dialog box, then you would use code like this instead:
Sub FindOnly()
    Application.Dialogs(xlDialogFormulaFind).Show
End Sub

Open in new window


I've attached a workbook that has two buttons:  one for "Find" and one for "Find and Replace".

Note:  Personally, I think that this type of handholding is a disservice to your novice Excel user.  Knowing the basic shortcut keys is essential to learning how to work with Excel and it's one of the very first things I teach to students (i.e., fellow employees).  I recommend the following resources to help you educate fellow users:

Excel 2003
http://office.microsoft.com/en-us/excel-help/keyboard-shortcuts-in-excel-2003-HP005203781.aspx?CTT=1

Excel 2007
http://office.microsoft.com/en-us/excel-help/excel-shortcut-and-function-keys-HP010073848.aspx 

Excel 2010
http://office.microsoft.com/en-us/excel-help/keyboard-shortcuts-in-excel-2010-HP010342494.aspx?CTT=1

Microsoft even offers free online training on these.

Regards,
-Glenn
EE-OnKey.xlsm
EE-OnKey.xls
0
Bright01Author Commented:
Glenn,

Thanks for the commentary and the code/lesson.  My users very much like to view Excel as an application instead of a tool.  So when we put together data sets and they want to do certain functions, they don't want to learn anything about Excel.  Personally, I completely agree with you.  That said, I'm just trying to do the best job I can.

With the code you gave to me, is there a way to limit the search to a particular range or column/row?  Right now, if I use your Find capability, it will find the references on different worksheets.  I need to limit the search actually to one particular column.

Thank you and Duncan both for the help here.

B.
0
Glenn RayExcel VBA DeveloperCommented:
The example I provided would not offer any specialized find (i.e., in a specific range on a sheet); it merely duplicates the Find dialog.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bright01Author Commented:
Glenn and Duncan,

Really appreciate the work here.  I've integrated it into my production copy and it works great!  Again, "thank you!".

I did have one last question;  In order to limit the search to the current spreadsheet instead of the Workbook, can I put the code either in the Sheet itself (instead of a module) or in "ThisWorkbook" and it will limit its search to only that worksheet?

Again, thanks,

B.
0
Glenn RayExcel VBA DeveloperCommented:
Yes; you can use this alternate statement to call the combination Find/Replace box which limits the search to the current sheet by default:
Sub Find_Replace()
    Application.CommandBars.FindControl(ID:=1849).Execute
End Sub

Open in new window


I've updated the example workbook with this.

-Glenn
EE-OnKey.xls
0
Bright01Author Commented:
Glenn,

I added your new code (Find Replace) in the Module.... linked the macro back to my button.  It's still searching the entire Workbook instead of just the Worksheet I'm on.

Any ideas?

B.
0
Glenn RayExcel VBA DeveloperCommented:
Hi Bright01,

I re-opened the file I attached here and it is limiting the search to the Sheet (using the Find & Replace button/macro).  I don't know why yours is expanded to the Workbook.

-Glenn
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.