Username (multiple usage)

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704
Good evening,
I've got a table C2:N7 where employess enter data. I want to record the last person to fill in each cell by entering their username on another grid Q2:AB7. (i.e. C2 data, username entered in cell Q2 etc.)
Is this feasable? If so, how. e.g. what would the code be and where and how do I enter it. I'm using vista & excel 2007.

Any help is greatly appreciated.
Thanks Jase
 
You should always disable events before writing new entries with Worksheet_Change to stop the code refiring ....

Cheers

Dave

And what if the code will never be outputting in the range c2:n7 ?
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You should still do it as the code will refire needlessly

Which in this particular situation may not cause a re-occurring loop, but if the scope of the code is enhanced, or this snippet is modified/used elsewhere by someoense else then an inefficiency may become a problem
 
Upvote 0
And what if your code breaks down in the middle, when the events have been disabled? The events will not be turned on again automatically...

I take it that when the scope of the code is enhanced, one looks at the full code and not 1 line.
 
Upvote 0
Well in that case you are advocating never disabling events because the code may get halted. Do you take the same view on changing screenupdating/calculationmode/statusbar etc?

For mine allowing circular code techniques that have potential impacts ranging from unintended scope changes to Excel crashing is far more dangeous

Regards

Dave
 
Upvote 0
Well in that case you are advocating never disabling events because the code may get halted. Do you take the same view on changing screenupdating/calculationmode/statusbar etc?

I do not know if you know this, but ScreenUpdating does not need to be returned to True. Do the test by executing (manually) after each other:

Code:
Sub test_generating_error()

    Application.ScreenUpdating = False
    
    MsgBox 1 / 0

End Sub

and

Code:
Sub test_screenupdating()

    MsgBox Application.ScreenUpdating

End Sub

It's not because you see this
Code:
Application.ScreenUpdating = True
line everywhere that you should use it.

The other 2 settings that you mention need decent error handling and are used as well by me (sparsely though since you need to limit interaction with sheets), error handling that is well beyond the scope of code written on forums.

For mine allowing circular code techniques that have potential impacts ranging from unintended scope changes to Excel crashing is far more dangeous

I take it that code from a message board is not just copy/pasted and used in a business/production environment without knowledge and administration. I refer to changing cell references in the change event. If not, it's the responsibility of the person(s) doing this and not of the coder. Documentation on the application can and should be included though.

Best regards,

Wigi
 
Upvote 0
I take it that code from a message board is not just copy/pasted and used in a business/production environment without knowledge and administration. I refer to changing cell references in the change event. If not, it's the responsibility of the person(s) doing this and not of the coder.
Well in my experience its's common practice for people take code from the forums and use it directly for work or personal user. Certainly other help forums - especially those with up front commercial models - see many repeat visits from the same people for this purpose

The other 2 settings that you mention need decent error handling and are used as well by me (sparsely though since you need to limit interaction with sheets), error handling that is well beyond the scope of code written on forums..

And to argue on one hand that techniques like those I mentioned below (even with a little error handling) lie outside the scope of the forums, yet accountability sits with end users to me sounds inconsistent.

I think we've burnt enough forum electrons on this, I'm happy to take this up further by PM if you wish to

Regards

Dave
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top