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.
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.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
You are guest
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 11 months agoOkay, I have Textbox inside Textbox that need to be extracted.
To post as a guest, your comment is unpublished.· 3 years agoVBA not working?!
To post as a guest, your comment is unpublished.· 3 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.· 8 months agoI have many Boxes in different sheets, There are 4 sheets which are having particular events on particular day and i would like to take that text boxes of particular day to new sheet combined for that day, How it works i have no idea how to get that data from 4 different sheet to one sheet.
To post as a guest, your comment is unpublished.· 3 years agoNot working here either. Select destination cell, click OK, and nothing happens.
To post as a guest, your comment is unpublished.· 3 years agoI have tried it in Win10 Excel2016 and Win8 Excel2010, it works both. What working enviroment you use?