Centering an InputBox and adding a Date suffix.

RWayneH
RWayneH used Ask the Experts™
on
Is there a way to add a suffix (current date(:MM-DD-YY)) to whatever name is added in this InputBox?  Of course if the sub is Canceled.. it would be blank..

Please advise and thanks.
RWayneH
Sub InsertBRTName()
 
Dim BRT_NameWithSuffix As String
 
'Position the cursor into the cell that want the result.
    Application.Goto Reference:="InsertHere"
    ActiveCell.Offset(RowOffset:=1, ColumnOffset:=1).Activate '1 row down, one over (R)
    
BRT_NameWithSuffix = InputBox("Enter a name that best describes the animal requirements.   Note: The name entered will get a :05-21-09 suffix added to the name to capture when it was created", "Save Animals Requirements", "YrlFinishRationWBeetPulpWestLot", 100, 1) ' Get user input
 
ActiveCell.Value = BRT_NameWithSuffix  'place it in cell
 
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
change the row >> 
ActiveCell.Value = BRT_NameWithSuffix & Format(Now(), ":mm-dd-yy")
Commented:
i forgot the condition , here we go >>

If BRT_NameWithSuffix <> "" Then ActiveCell.Value = BRT_NameWithSuffix & Format(Now(), ":mm-dd-yy") 'place it in cell
 
Top Expert 2015

Commented:
You can use the following code and it will do what you are looking for...
Saurabh...

Sub InsertBRTName()
 
Dim BRT_NameWithSuffix As String
 
'Position the cursor into the cell that want the result.
    Application.Goto Reference:="InsertHere"
    ActiveCell.Offset(RowOffset:=1, ColumnOffset:=1).Activate '1 row down, one over (R)
    
BRT_NameWithSuffix = InputBox("Enter a name that best describes the animal requirements.   Note: The name entered will get a :05-21-09 suffix added to the name to capture when it was created", "Save Animals Requirements", "YrlFinishRationWBeetPulpWestLot", 100, 1) & ":" & Format(Now(), "mm-dd-yy")
ActiveCell.Value = BRT_NameWithSuffix
 
End Sub

Open in new window

Author

Commented:
Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial