简体   繁体   中英

Excel VBA userform texbox input error

I am trying to create a macro that will input whatever is written in the userform textbox onto the active cell. However, whenever I try to run that portion of the code, i get an error 438. Here is a sample of the part there shows up on the debug.

With Selection.Font
.Bold = True
End With
ActiveCell.Value = UserForm2.Controls("TextBox" & i).Caption
ActiveCell.Offset(1, 0).Select

Error 438 means the Object doesn't support the property or method. Textbox.Caption doesn't exist. For a full list of methods / properties see MSDN TextBox Properties

As on how to fix your code: ActiveCell.Value = UserForm2.Controls("TextBox" & i).Value or ActiveCell.Value = UserForm2.Controls("TextBox" & i).Text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM