Excel Macro

rkymtngraz

New Member
Joined
Aug 15, 2011
Messages
3
I would like to add a button in an Excel spreadsheet with a macro that does the following:

1. Copies a date field and a separate text field and appends them together.
2. Takes this new string (date: text) and appends it to a third field so that over time you would wind up with many date: text strings.
3. Clears the contents from the original two fields so that the user can make a new entry.

In effect this macro would keep an archive of project status while allowing the user to enter a new update in the same two fields each time.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try like this

Code:
Sub Appnd()
Range("C" & Rows.Count).End(xlUp).Offset(1).Value = Format(Range("A1").Value, "dd-mm-yyyy") & ": " & Range("B1").Value
Range("A1:B1").ClearContents
End Sub
 
Upvote 0
Since I am very new to this let me be more specific.

The user will enter a date into b29, text in c29
When user clicks button b29 appended to c29 and added to text already in c30. b29 and c29 are then cleared and the cursor left in b29. User
then enters new data into b29 and c29, etc.

Thanks for clarifying.
 
Upvote 0
Try

Code:
Sub Appnd()
With Range("C30")
    .Value = .Value & Chr(10) & Format(Range("B29").Value, "dd-mm-yyyy") & ": " & Range("C29").Value
    .WrapText = True
End With
Range("B29:C29").ClearContents
Range("B29").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

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