Solved

Move to a command button rather than a range

Posted on 2013-12-05
17
232 Views
Last Modified: 2013-12-05
Folks,
My worksheets have command buttons. When I activate a worksheet I send the cursor to a cell location. Instead of a cell location how about to a command button, e.g., "cmdPrintSheet"
0
Comment
Question by:Frank Freese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 3
17 Comments
 
LVL 4

Expert Comment

by:andrew_man
ID: 39698440
Sub P()

    Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
End Sub
0
 
LVL 4

Expert Comment

by:andrew_man
ID: 39698444
and link to a button or an image
0
 

Author Comment

by:Frank Freese
ID: 39698518
Andrew,
Confused here?
What I am looking for is the ability to go to a command button when the sheet is activated. I did not see that in you suggestion or did not understand. I already have the code behind the command button.

In Access I can do this
cmdPrint.SetFocus
when a form opens.

In Excel I do this Range("A1")
I was thinking something along this line:

Sheet1.Controls("cmdPrint" ).Select

in the worksheet_activate section.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:andrew_man
ID: 39698552
Range("A1").selected
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False

I suggest you should post your worksheet here!
0
 

Author Comment

by:Frank Freese
ID: 39698615
OK...see attached
When this worksheet activates I would like it to have the command button
 "cmdDisplayResultsShaded" selected.
Thanks
MoveToCommandDisplayData.xlsm
0
 

Author Comment

by:Frank Freese
ID: 39698677
Please used this file instead - the other has problems
Sorry about that
MoveToCommandDisplayData.xlsm
0
 
LVL 34

Expert Comment

by:Norie
ID: 39698686
Why do you want to select/goto the command button?
0
 
LVL 4

Expert Comment

by:andrew_man
ID: 39698713
Asker,

What is the version of your excel?
0
 

Author Comment

by:Frank Freese
ID: 39698752
Excel 2007 version
The reason is I'd like to set a default for the user that is not a cell.
0
 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 39698786
Not sure what you mean but you can select the button with this.
Shapes("cmdDisplayResultsShaded").Select

Open in new window

Don't know if it'll make the button 'default'.
0
 

Author Comment

by:Frank Freese
ID: 39698860
imnorie,
Since the worksheet will be protected I had to check "Edit objects" before I protected the worksheet. When I did that your code worked.
0
 

Author Comment

by:Frank Freese
ID: 39698936
I've requested that this question be closed as follows:

Accepted answer: 0 points for fh_freese's comment #a39698860

for the following reason:

Folks,
I accepted Imnorie's code with this only change. Since the worksheet will be protected I had to check "Edit objects" before I protected the worksheet. When I did that your code worked.
Thanks to all -
0
 
LVL 4

Expert Comment

by:andrew_man
ID: 39698903
Do you think no any solutions?
0
 

Author Comment

by:Frank Freese
ID: 39698933
Did not intend to award myself points but instead Imnorie.
0
 

Author Closing Comment

by:Frank Freese
ID: 39698937
thanks
sorry for the mix up
0
 
LVL 4

Expert Comment

by:andrew_man
ID: 39698943
Good!
0
 
LVL 34

Expert Comment

by:Norie
ID: 39698970
fh_freeze

Glad it worked.

Wasn't sure about protection as the worksheet in the attached workbook didn't appear to be protected.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question