Run code on button press or tab select

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have several worksheets within my workbook.
On one worksheet when i visit it i have columns Y:AH within my view upon open.
On another worksheet i have a button which goes to the worksheet above but column AV

As you can see this is the clash.

Can the code be controlled/run depending if you click a button or select the tab of the sheet ?

Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I thought this might sort my issue out,

I have a macro of which when i click on run it runs fine so that code is working.
However in a module i put the following but it doesn't call the macro mentioned above,did i write it incorrectly ?

Code:
Private Sub Worksheet_Activate()Call InfoCells Macro
End Sub
 
Upvote 0
What is the name of the macro you want to call. Please supply the full title ie
Code:
Private Sub Macro1()
 
Upvote 0
Nope, you had the word Macro afterwards, MAIT doesn't.
 
Upvote 0
Many thanks for the advice.
The above didnt work so ive decided to have both items on the same sheet.

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top