I wrote VBA code that updates changes made in Excel to a database (SQL server).
How can I distribute this code to other users? I stored the changed values in an array using the Worksheet_Change subroutine.Sub Worksheet_Change(ByVal Target As Range)
'add value to array
End sub
I also have code to update the database:
Sub update_database()
'update database
End sub
I stored both subroutines in the sheet1 code.
How can I distribute this macro without the user copying and pasting my code?
I know that I can put my macro in q开发者_StackOverflow中文版uick link. But I don't know how to deal with the Worksheet_Change procedure which I think is bound to the sheet.Put your code in an Addin and distribute that.
Note: to make the addin respond to all Worksheet_Change events
, see How can an Excel Add-In respond to events in any worksheet?
精彩评论