ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Excel Programming (https://www.excelbanter.com/new-users-excel/35127-excel-programming.html)

Sprad-Dog

Excel Programming
 
I need help with a function... I'm trying to enter several data
entries(integers) from a 'User Form' into a range of cells. The entries need
to go from (B44:j79) one at a time - clearing the entry from the 'User Form'
[textbox] after each entry. I can get the data in the first cell (B44), but
it will not advance to the next cell down - or clear the entry after I hit
the <enter key. Here is what I have already:

Private Sub TextBoxEnterData_Change()

Worksheets(2).Select

For Each Cell In Worksheets("Data Sheet").Range("b44:j79")
Range("B44").Value = TextBoxEnterData.Value

If Cell.Value < 0# Then
Cell.Value = Null
End If

Next Cell

End Sub

Can you please help me out??

Thanks!

Bob Phillips

You can't cledar the textbox after each one, else you will just fill the
arry (apart from th first cell) with nothing.

Private Sub TextBoxEnterData_Change()
For Each Cell In Worksheets("Data Sheet").Range("b44:j79")
cell.Value = TextBoxEnterData.Value
Next Cell
TextBoxEnterData.Value

End Sub


--
HTH

Bob Phillips

"Sprad-Dog" wrote in message
...
I need help with a function... I'm trying to enter several data
entries(integers) from a 'User Form' into a range of cells. The entries

need
to go from (B44:j79) one at a time - clearing the entry from the 'User

Form'
[textbox] after each entry. I can get the data in the first cell (B44),

but
it will not advance to the next cell down - or clear the entry after I hit
the <enter key. Here is what I have already:

Private Sub TextBoxEnterData_Change()

Worksheets(2).Select

For Each Cell In Worksheets("Data Sheet").Range("b44:j79")
Range("B44").Value = TextBoxEnterData.Value

If Cell.Value < 0# Then
Cell.Value = Null
End If

Next Cell

End Sub

Can you please help me out??

Thanks!




Duke Carey

The line

Range("B44").Value = TextBoxEnterData.Value

needs to be

Cell.Value = TextBoxEnterData.Value



"Sprad-Dog" wrote:

I need help with a function... I'm trying to enter several data
entries(integers) from a 'User Form' into a range of cells. The entries need
to go from (B44:j79) one at a time - clearing the entry from the 'User Form'
[textbox] after each entry. I can get the data in the first cell (B44), but
it will not advance to the next cell down - or clear the entry after I hit
the <enter key. Here is what I have already:

Private Sub TextBoxEnterData_Change()

Worksheets(2).Select

For Each Cell In Worksheets("Data Sheet").Range("b44:j79")
Range("B44").Value = TextBoxEnterData.Value

If Cell.Value < 0# Then
Cell.Value = Null
End If

Next Cell

End Sub

Can you please help me out??

Thanks!



All times are GMT +1. The time now is 10:44 AM.

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