Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do I code VBA to hit button on a different worksheet?

This works perfectly.

Thanks!


NickHK wrote:
Here's one way

ThisWorkbook.Worksheets("Sheet3").CommandButton4.V alue = True

NickHK

wrote in message
ups.com...

Yes, I am trying to fake a button click. The worksheet (there are many
worksheets, otherwise I would just click the button myself) is
protected so I can't change the code.

How do I go about doing #2? Would that fake a click?

Thanks.

NickHK wrote:
If you are trying to fake a button click, rather than Dave's suggestion

of
code location, you have a couple of options:
1 - Calling the code for the click event;
Call cmdButton_Click
But you will have change the _Click routine from Private (default) to

Public
so it can be seen outside the module.
Also reference the correct WB/WS as required.

2 - Some people feel it is wrong to call events like the above. If so

use
cmdButton.Value=True

NickHK

wrote in message
oups.com...

I have a protected worksheet that has a button that I want to execute
using VBA.

The worksheet in question is protected with the exception of certain
cells where I can paste values.

I am creating a VBA to do all the pasting but I can't figure out how

to
execute the button.

Run or Call don't work.

Help.

TIA.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command button to toggle worksheet event code on / off? Fred[_2_] Excel Discussion (Misc queries) 15 July 31st 07 11:50 AM
c# code to add button control to the worksheet!!!! .NetProf Excel Programming 0 January 30th 06 04:45 AM
How to make a button VBA code reference other VBA code subroutines??? gunman[_9_] Excel Programming 4 September 27th 05 01:01 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
print different worksheet by pressing visible button on worksheet Confused Excel Worksheet Functions 2 June 13th 05 02:22 PM


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"