Bright01
asked on
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.
Here's what I tried to do;
Macro2()
Application.OnKey "^{+}F"
End Sub
But it doesn't work.
Any help would be appreciated.
B.
Please see the new attachement file
with the following code,
Now I know what you want
Ducan
functionkey.xls
with the following code,
Private Sub Workbook_Activate()
Application.OnKey "+^{F}", "functionkey"
End Sub
Now I know what you want
Ducan
functionkey.xls
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
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
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
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
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
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
for other experts to look into it ?
Duncan
ASKER
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.
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.
Yes.
Duncan
Duncan
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:
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
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
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
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
Yes; you can use this alternate statement to call the combination Find/Replace box which limits the search to the current sheet by default:
I've updated the example workbook with this.
-Glenn
EE-OnKey.xls
Sub Find_Replace()
Application.CommandBars.FindControl(ID:=1849).Execute
End Sub
I've updated the example workbook with this.
-Glenn
EE-OnKey.xls
ASKER
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.
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.
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
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
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