How to convert text in text box to cell content in Excel?
If there are some text boxes in a sheet, and you want to convert the contents in the text boxes into cells separately as below screenshot shown, are there any quick ways to solve this job except entering one by one in Excel? In this article, I introduce a macro to do you a favor on this problem.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
Except macro code, there is no trick that can quickly convert text boxes to cell contents.
1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below code to the Module script.
VBA: Convert text boxes to cell
Sub TextboxesToCell() 'UpdatebyExtendoffice20160918 Dim xRg As Range Dim xRow As Long Dim xCol As Long Dim xTxtBox As TextBox Set xRg = Application.InputBox("Select a cell):", "Kutools for Excel", _ ActiveWindow.RangeSelection.AddressLocal, , , , , 8) xRow = xRg.Row xCol = xRg.Column For Each xTxtBox In ActiveSheet.TextBoxes Cells(xRow, xCol).Value = xTxtBox.Text xTxtBox.Delete xRow = xRow + 1 Next End Sub
3. Press F5 key to run the code, a dialog pops out to remind you select a cell to export the textbox contents. See screenshot:
4. Click OK. Now all text boxes have been converted to cell contents.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 24 days agoOkay, I have Textbox inside Textbox that need to be extracted.
- To post as a guest, your comment is unpublished.· 2 years agoVBA not working?!
- To post as a guest, your comment is unpublished.· 2 years agoIt works perfectly here. What happen while you running the code? It changes nothing? If you could, please describ more about your data and problem. Thank you.
- To post as a guest, your comment is unpublished.· 2 years agoNot working here either. Select destination cell, click OK, and nothing happens.
- To post as a guest, your comment is unpublished.· 2 years agoI have tried it in Win10 Excel2016 and Win8 Excel2010, it works both. What working enviroment you use?