Text box and formulas

kevinc1973

New Member
Joined
Jun 20, 2019
Messages
23
Hello all,
I have a question that I hope I can explain it clearly but will give it my best shot. I am making a spreadsheet for chemical inventory and I created user forms to enter the data to the correct cells on the spreadsheets but just having trouble trying to figure out how to have a certain text box (text box 7) not write anything to the cell (I) if left blank. I want to put a formula in the cell of the spreadsheet (column I), if the text box is empty the formula would stay and if I put a number in the text box it would write over the formula. Is there a formula to not have the text box write to cell if left blank and where would I put the formula? Not sure if it would go under the command button to enter data or somewheres else? Thanks in advance
 
Yes, very simple. It's not a formula, but in the code logic. For a better answer, please show the code you currently have. It's going to be something like:
VBA Code:
If TextBox7 <> "" Then
   Cells.(SomeRow, "I") = TextBox7.Value
End If
' if text box is blank, do nothing
but you didn't tell us how it's determining what cell to write to.
 
Upvote 0

Forum statistics

Threads
1,226,837
Messages
6,193,253
Members
453,784
Latest member
Chandni

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