Macro Help - Fairly Advanced.
On 20 Jun, 11:55, NPell wrote:
On 19 Jun, 14:28, "Bob Phillips" wrote:
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.- Hide quoted text -
- Show quoted text -
This should work, i can tell, but it doesnt.
Can i just ask where its drawing the Username information from, or if
i need to add more to the code?- Hide quoted text -
- Show quoted text -
Oh, sorry, i didnt say thankyou!
I do appreciate you helping, Bob.
|