View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
chickalina chickalina is offline
external usenet poster
 
Posts: 28
Default Enter a User Name When Changes are Made

Works like a charm!!! Thanks so much!

"Gary''s Student" wrote:

There can be only one change event macro on a given sheet. So....we must
combine your logic with mine:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
On Error GoTo endit
Application.EnableEvents = False
If IsNumeric(Target) Then
Target.Offset(0, 8).Value = Format(Date, "mm/dd/yyyy")
Target.Offset(0, 7).Value = Environ("username")
End If
End If
endit:
Application.EnableEvents = True
End Sub

REMEMBER: erase the older versions.

--
Gary''s Student - gsnu200796


"chickalina" wrote:

I'm getting a compile error with another part of my VB code.
M


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("A:A")) Is Nothing Then
On Error GoTo endit
Application.EnableEvents = False
If IsNumeric(Target) Then
Target.Offset(0, 8).Value = Format(Date, "mm/dd/yyyy")
End If
End If
endit:
Application.EnableEvents = True
End Sub


"Gary''s Student" wrote:

Insert the following worksheet event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set a = Range("A:A")
If Intersect(t, a) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Offset(0, 7).Value = Environ("username")
Application.EnableEvents = True
End Sub

Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200796


"chickalina" wrote:

I have a spreadsheet that is shared and there can be up to 12 people using it
at the same time. The Column A is Work Order number and Column H is Submitted
By. I want to have the spreadsheet automatically fill in the Submitted By
cell when a Work Order is entered into Column A. Is this possible?
Thanks for any help!
M