Excel Programming

S

Sprad-Dog

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!
 
B

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
 
D

Duke Carey

The line

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

needs to be

Cell.Value = TextBoxEnterData.Value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top