Space Underscore to break a line ( _)
.InsertLines StartLine, "If Intersect(Target, Me.Range("a1:a100")) Is _
Nothing Then"
Put "" around the exact code you want written to the line.
Mike F
"Valeria" wrote in message
...
Hi Frank,
it does not seem to work: I get a syntax error on this line
.InsertLines StartLine, "If Intersect(Target, Me.Range("a1:a100")) Is
Nothing Then"
I actually have the problem with this module writing code that I do not
know
where to break the lines and put the ""... I always seem to get these
syntax
errors...
Thank you,
Best regards,
Valeria
"Frank Kabel" wrote:
Hi Valeria
(not tested) but try:
Sub test()
Dim StartLine As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
StartLine = .CreateEventProc("Change", "Worksheet") + 1
.InsertLines StartLine, "If Intersect(Target, Me.Range("a1:a100"))
Is
Nothing Then"
.InsertLine Startline+1, "Exit sub"
.insertLine,startline+2, "End if"
'....
"Valeria" wrote:
Dear Experts,
I would like to write a macro in a worksheet code of a spreadsheet
from
another macro. I have visited Cheap Pearson's page,
http://www.cpearson.com/excel/vbe.htm, which was very useful, but
still I do
not understand how to write my code (I am not very good at it! :-)
[...]
Sub test()
Dim StartLine As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
StartLine = .CreateEventProc("Change", "Worksheet") + 1
.InsertLines StartLine, _