L
Les Stout
Hello all, Tom Ogilvy helped me extensively last night to get the above
working. I now have the problem that if i include the code within my
routine it breaks the code and the routine stops. The code is below and
after i have inserted this code in the code section of "sheet1" i need
to carry on with my routine to protect and save the workbook. can
anybody help me with this please ?
Sub InsertProc()
Dim sname As String
Dim StartLine As Long
sname = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(sname).CodeModule
StartLine = .CreateEventProc("Change", "Worksheet") + 1
.InsertLines StartLine, "Dim VRange As Range"
.InsertLines StartLine + 1, "Set VRange =
ActiveSheet.Columns(""H:H"")"
.InsertLines StartLine + 2, "Target.Font.ColorIndex
= 3"
.InsertLines StartLine + 3, "Target.Font.Bold =
True"
End With
End Sub
Thank you in advance
Les Stout
*** Sent via Developersdex http://www.developersdex.com ***
working. I now have the problem that if i include the code within my
routine it breaks the code and the routine stops. The code is below and
after i have inserted this code in the code section of "sheet1" i need
to carry on with my routine to protect and save the workbook. can
anybody help me with this please ?
Sub InsertProc()
Dim sname As String
Dim StartLine As Long
sname = ActiveSheet.CodeName
With ActiveWorkbook.VBProject.VBComponents(sname).CodeModule
StartLine = .CreateEventProc("Change", "Worksheet") + 1
.InsertLines StartLine, "Dim VRange As Range"
.InsertLines StartLine + 1, "Set VRange =
ActiveSheet.Columns(""H:H"")"
.InsertLines StartLine + 2, "Target.Font.ColorIndex
= 3"
.InsertLines StartLine + 3, "Target.Font.Bold =
True"
End With
End Sub
Thank you in advance
Les Stout
*** Sent via Developersdex http://www.developersdex.com ***