Adding auto name & number notes to a cell

marlowem

New Member
Joined
Jun 28, 2011
Messages
7
Hi Guys,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I was wondering is fanyone can help me please? I'm after a Marco that when ran, will populate a cell with the following;<o:p></o:p>
<o:p></o:p>
(auto number) - (user initials or registered name) - (static date) <o:p></o:p>
<o:p></o:p>
However, what I'd also like is that the contents of the cell are recognised and the next time the macro is ran in the same cell the following happens.<o:p></o:p>
<o:p></o:p>
(carriage return)
(auto number) - (user initials or registered name) - (static date) <o:p></o:p>
<o:p></o:p>

<o:p></o:p>
Any help greatly appreciated!!<o:p></o:p>
<o:p></o:p>
Thanks<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
 
Last edited:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
This is a bit unclear. Do you want to add this directly to a cell or in a comment in the cell. What should trigger this action?
 
Upvote 0
Hi,
Apologies. I would like to add this directly to a cell and the trigger would be the press of a macro button on the toolbar.
 
Upvote 0
Try this

Code:
Sub test()
Dim i As Long
With ActiveCell
    If .Value = "" Then
        .Value = Chr(10) & 1 & " - " & Environ("username") & " - " & Format(Date, "dd/mm/yyyy")
        .WrapText = True
    Else
        i = Len(.Value) - Len(Replace(.Value, Chr(10), "")) + 1
        .Value = .Value & Chr(10) & i & " - " & Environ("username") & " - " & Format(Date, "dd/mm/yyyy")
    End If
End With
End Sub
 
Upvote 0
VoG you are a star! Works like a dream. Whilst my hand is in the cookie jar.....<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Is there any way to change the environment name to use say first & last rather than username (we have auto generated ID's which don't relate to much). Even better if it could concatenate them to form initials?!<o:p></o:p>
<o:p></o:p>
Thanks again<o:p></o:p>
:biggrin:
 
Upvote 0
This will use the user name that is entered in Tools > Options in Excel

Rich (BB code):
Sub test()
Dim i As Long
With ActiveCell
    If .Value = "" Then
        .Value = Chr(10) & 1 & " - " & Application.UserName & " - " & Format(Date, "dd/mm/yyyy")
        .WrapText = True
    Else
        i = Len(.Value) - Len(Replace(.Value, Chr(10), "")) + 1
        .Value = .Value & Chr(10) & i & " - " & Application.UserName & " - " & Format(Date, "dd/mm/yyyy")
    End If
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

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