ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add Value from Textbox to next cell in range (https://www.excelbanter.com/excel-discussion-misc-queries/221164-add-value-textbox-next-cell-range.html)

Mitch

Add Value from Textbox to next cell in range
 
I have a range of cells (say A4:A400). My current plan is to call up a
userform with a button, the userform has a textbox. I want the value of the
textbox to populate the next blank cell in the range of cells when I select.
Anyone have any ideas?

Mitch

Add Value from Textbox to next cell in range
 
This is what I have so far. However, this is leaving a blank cell at the top
of the range but I don't want it to.

Range(A4:A400).Find("", ActiveCell, Searchdirection:=x1Next).Select
ActiveCell.Value =Textbox1.Text

Any other ideas?

"mitch" wrote:

I have a range of cells (say A4:A400). My current plan is to call up a
userform with a button, the userform has a textbox. I want the value of the
textbox to populate the next blank cell in the range of cells when I select.
Anyone have any ideas?


Bernie Deitrick

Add Value from Textbox to next cell in range
 
Range("A4:A400").SpecialCells(xlCellTypeBlanks).Ce lls(1).Value =
Textbox1.Text

But if it is a number, you might want to explicitly make it one:

Range("A4:A400").SpecialCells(xlCellTypeBlanks).Ce lls(1).Value =
CDbl(Textbox1.Text)

HTH,
Bernie
MS Excel MVP


"mitch" wrote in message
...
This is what I have so far. However, this is leaving a blank cell at the
top
of the range but I don't want it to.

Range(A4:A400).Find("", ActiveCell, Searchdirection:=x1Next).Select
ActiveCell.Value =Textbox1.Text

Any other ideas?

"mitch" wrote:

I have a range of cells (say A4:A400). My current plan is to call up a
userform with a button, the userform has a textbox. I want the value of
the
textbox to populate the next blank cell in the range of cells when I
select.
Anyone have any ideas?




All times are GMT +1. The time now is 02:50 PM.

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