View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Macro Help - Fairly Advanced.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "K:K" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "v" Then

.Offset(0, 2).Value = Environ("Username")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"NPell" wrote in message
...
Hello,

This is a bit of a re-post, but it seems to have fallen off the radar
a bit.

I have a macro that populates the username in a cell, that works fine.
But I dont want to have to Run the macro (or use Ctrl+Shift+U, as i
have assigned) for this to populate.

The username is needed to populate in M, based on the value of column
K being V

For example:
K M
-----------
v username

v username
v username

v username


K can only be "v" due to Data Validation. But it can be on any row.

Basically to put it in formula terms.
=IF($K1="v", Run Macro in M1)

Is this do-able? Ive seen suggestions with absolute cell references,
but this isnt absolute.

If anybody can help, or tell me if its even possible, it would be much
appreciated.