Adding two macros to the same spreadsheet

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:15 PM GMT


Good day Tom. I have a workbook with 6 named tabs. I have set up a 'front page' with 12 command buttons in which 6 buttons point to each individual named tab to cell 'A1. What I am trying to achieve is with the other 6 buttons point to a different cell within each named tab ie. cell AB240. is there a way i can do this. I am using2003. i.e Sub Dorset_X() Sheets("Dorset X").Select


End Sub I would like to add another macro to this sheet but point to cell AB240. your help would be much appreciated


Bernard Barry, You say command buttons (which reside on the control toolbox toolbar) but it sounds like you are using a Button from the Forms toolbar. There is nothing special about the name of the macro you assign to one of these buttons (from the forms toolbar - different story for ActiveX commandbuttons). So you can just create a new macro such as

Sub Dorset_X_AB240() Sheets("Dorset X").Select


End Sub

and assign that macro to one of your buttons.

If it were a command button, then in the sheet module of the sheet, you would have

Private Sub Commandbutton1_Click()

end sub

you might have

Private Sub Commandbutton1_Click() Dorset_X end sub

to have it call you Dorset_X macro. If that is the case, then for another command button you would do

Private Sub CommandButton7_Click() Dorset_X_AB240 End Sub

if you used the macro I suggested.

I can only go on what you tell me and what you have told me isn't clear as to exactly what you situation is. But selecting AB240 in general is just changing Range("A1").Select to Range("AB240").select in the macro you create to do that.

If I have misunderstood or haven't answered the question, please clarify you needs in a followup.


©2024 eLuminary LLC. All rights reserved.