Inputting data from text boxes into different worksheets of a workbook.


Posted by M Walker on July 17, 2001 1:31 AM

Hi,

I'm having a little trouble with the macro that i'm writing. I would lik the user of my macro to input data into a textbox and upon exiting put the data into the spreadsheet into a specific cell.

At the moment the user can select an item from a drop down box but can i use the selection to reference a cell (and if i can i haven't got a clue what the code is!)

Just to round things off nicley i would like the new total to replace the old one - save upon exiting excel.

ANy help would be very much appreciated.

Thanks in advance,

M Walker

Posted by Ivan F Moala on July 17, 2001 2:10 AM

Use the Textboxs Exit event to put a value into
your sheet eg.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("A1") = TextBox1.Value
End Sub


Ivan

Posted by M Walker on July 17, 2001 3:11 AM

Cheers Ivan,

Just one problem. The code that you gave me did work... once. However, it placed "1" in every cell in my range rather than the one selected from the drop down list and then caused excel to crash. Any ideas?

Thanks,

M Walker



Posted by Ivan F Moala on July 17, 2001 3:34 AM

Oh no !!

1) What version of excel ?
2) What other code have you got for the textbox ?
3) What code are you using ?

Ivan Cheers Ivan, Just one problem. The code that you gave me did work... once. However, it placed "1" in every cell in my range rather than the one selected from the drop down list and then caused excel to crash. Any ideas? Thanks,