ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox Do nothing (https://www.excelbanter.com/excel-programming/434813-textbox-do-nothing.html)

Woodi2

textbox Do nothing
 
Hi, i am trying to use a textbox on a userform. I would like the code below
to do nothing if the textbox value is empty.

I can use this code
ActiveCell.Offset(0, 8) = TextBox8.Value
but I need the textbox not to perform a function if the textbox is empty.
This is because the cell that the textbox is writing to contains a Sum. I
only want this Sum over writing with the textbox value if the textbox
contains a value.
Thanks

Mike H

textbox Do nothing
 
Hi,

Enclose it in an IF statement

If TextBox8.Value < "" Then
ActiveCell.Offset(0, 8) = TextBox8.Value
Else
'maybe do something else
End If

Mike

"Woodi2" wrote:

Hi, i am trying to use a textbox on a userform. I would like the code below
to do nothing if the textbox value is empty.

I can use this code
ActiveCell.Offset(0, 8) = TextBox8.Value
but I need the textbox not to perform a function if the textbox is empty.
This is because the cell that the textbox is writing to contains a Sum. I
only want this Sum over writing with the textbox value if the textbox
contains a value.
Thanks



All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com