Hi all,
I'm trying to use a macro to automatically insert code for a worksheet event (worksheet selection change). I was think
along the lines of the following below. Any thoughts?
Dim wks1 As Worksheet
Sheets("Data".Select
Set wks1 = ThisWorkbook.ActiveSheet
wks1.CodeModule.AddFromString "Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)" & vbCrLf & vbTab & _
"SMain2" & vbCrLf & _
"End Sub"
Range("A1".Select
Any input would be appreciated.
thx,
Cram
I'm trying to use a macro to automatically insert code for a worksheet event (worksheet selection change). I was think
along the lines of the following below. Any thoughts?
Dim wks1 As Worksheet
Sheets("Data".Select
Set wks1 = ThisWorkbook.ActiveSheet
wks1.CodeModule.AddFromString "Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)" & vbCrLf & vbTab & _
"SMain2" & vbCrLf & _
"End Sub"
Range("A1".Select
Any input would be appreciated.
thx,
Cram