Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default Macro Help - Fairly Advanced.

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.



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.





  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default Macro Help - Fairly Advanced.

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?
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default 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.
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Macro Help - Fairly Advanced.

No problem.

It gets the username from the system login. In what way does it not work?

--
HTH

Bob

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

"NPell" wrote in message
...
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.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default Macro Help - Fairly Advanced.

On 20 Jun, 18:42, "Bob Phillips" wrote:
No problem.

It gets the username from the system login. In what way does it not work?

--
HTH

Bob

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

"NPell" wrote in message

...
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.- Hide quoted text -

- Show quoted text -


Ah ok.

Well, It just doesnt show anything when i do put the "v" in cell in
Column K. It just seems as if it doesnt run or doesnt register.
Reply
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
Creating an advanced Macro Sean Excel Discussion (Misc queries) 1 May 2nd 08 09:48 PM
Help with fairly advanced list/print macro. Olle Svensson Excel Discussion (Misc queries) 4 November 15th 06 02:19 PM
Advanced macro Luke Excel Discussion (Misc queries) 5 August 31st 05 03:55 PM
HELLLP!!!! This should be fairly simple I would think! InfinityDesigns Excel Discussion (Misc queries) 7 June 19th 05 03:54 AM
Fairly Complex IF Statement Patrick Excel Worksheet Functions 3 May 9th 05 09:48 PM


All times are GMT +1. The time now is 11:02 AM.

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

About Us

"It's about Microsoft Excel"