textbox value to a cell

AnthonyMinnaar

New Member
Joined
Aug 25, 2020
Messages
28
Office Version
  1. 2013
Platform
  1. Windows
Hi all, I was wondering if there's a way to send the value of a textbox to a cell (see picture below).

I have found a post on the forum where someone posted the following:

Private Sub OK_Click()
Sheets("Sheet1").Range("C9") = TextBox1.value
Sheets("Sheet1").Range("C10") = TextBox2.value
End Sub

But I cant seem to make this work, what am I doing wrong? :)

thanks in advance,

Anthony

1693897264383.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
That looks like it's for a user form, perhaps try:
VBA Code:
Private Sub OK_Click()

Sheets("Sheet1").Range("C9").Value = Sheets("Sheet1").Shapes("TextBox1").TextFrame.Characters.Text
Sheets("Sheet1").Range("C10").Value = Sheets("Sheet1").Shapes("TextBox2").TextFrame.Characters.Text

End Sub
 
Upvote 0
That looks like it's for a user form, perhaps try:
VBA Code:
Private Sub OK_Click()

Sheets("Sheet1").Range("C9").Value = Sheets("Sheet1").Shapes("TextBox1").TextFrame.Characters.Text
Sheets("Sheet1").Range("C10").Value = Sheets("Sheet1").Shapes("TextBox2").TextFrame.Characters.Text

End Sub
that works! thank you :)
 
Upvote 0

Forum statistics

Threads
1,216,107
Messages
6,128,866
Members
449,475
Latest member
Parik11

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