Copy cell to text box

Walczakts

New Member
Joined
Oct 4, 2019
Messages
1
I'm sorry in advance if the answer is painfully obvious, but I am not very knowledgeable when it comes to macros.
I am attempting to copy the contents of cell "C2" and paste it a line above the first line in "textbox2" or a line below the last line in "Textbox 2" while keeping the text that is already in the textbox with the push of a button. Is this possible to do with a macro, if so how? Hopefully my question makes sense and one of you excel guru's can help out.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi. Ive used a worksheet change event macro but you could assign something similar to a button if you want.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

Set rng = Intersect(Target, Range("c2"))

If Not rng Is Nothing Then
    If rng.Value <> "" Then
        With TextBox1
            .MultiLine = True
            .Value = rng.Value & vbLf & TextBox1.Value
        End With
    End If
End If

End Sub

You right click on the sheet tab and press view code. Insert the code there. Then overtype C2 and see if it works. May need to change the name of the textbox in the code.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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