LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default A macro written by a macro

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! :-)

I would like to put this in the worksheet code (thank you Frank!):

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("a1:a100")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo errhandler
Application.EnableEvents = False
With Target
.Offset(0, 1).Value = Application.UserName
.Offset(0, 2).Value = Format(Date, "DD-MMM-YYYY")
End With

errhandler:
Application.EnableEvents = True
End Sub


I've come to this point:

Sub test()

Dim StartLine As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
StartLine = .CreateEventProc("Change", "Worksheet") + 1
.InsertLines StartLine, _

Here I don't know anymore how to express my code!

Could somebody please help me?

Many thanks in advance,
best regards,

--
Valeria
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how we can run macro after a written text in a column rich_jonathan Excel Discussion (Misc queries) 2 March 21st 08 10:29 PM
Create .NET object written in C# in Excel Macro Tom Chau Excel Discussion (Misc queries) 0 April 11th 06 07:38 AM
I have never written a macro wickd03 Excel Discussion (Misc queries) 2 March 27th 06 05:34 AM
I have never written a macro wickd03 Excel Discussion (Misc queries) 0 March 26th 06 11:42 PM
How to get Username written in logfile (.txt) through macro Intruder Excel Programming 1 July 28th 03 11:16 PM


All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"