Trigger a Macro

morrisgr

Board Regular
Joined
Dec 17, 2005
Messages
62
Hi.
The code below triggers a Macro on a SPECIFIC sheet............but I have 40 sheets. Can the code be altered to work on all of them?
Many thanks
Morris...........hopefully not a daft question this time

Sub worksheet_change(ByVal target As Range)
Set target = Range("A1")
If target.Value = "Delete" Then
Call Macro1
End If
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi Morris,

Does your Macro names Macro1 have any specific sheet references contained within?
 
Upvote 0
Hi.
It will have.
The info from each of the 40 sheets will be copied to a 'Summary' sheet. As data is entered each day to one of the 40 sheets, the macro will be triggered to copy the data to 'Summary', and the macro will read the previous last entry and add the new data to it.

Rgds
Morris
 
Upvote 0
Could you pop a copy of your macro here please so I can have a look for you?
 
Upvote 0
Ooops.
I've only just started this project so the macro is only basic but it should give you an idea of what I need.
Many thanks for your interest.
Morris

Sub Macro1()
membNumb = Application.InputBox("Enter a Membership number")
' this accesses the Members' sheet
Set Sh1 = Worksheets(membNumb)
Sh1.Activate
Range("A1:F1").Copy
Sheets("Summary").Activate
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Range("A1").Offset(LastRow + 1).Select
Selection.PasteSpecial Paste:=xlValues
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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