Returning Data to sheet using a UserForm


Posted by Jon Eubanks on December 14, 2001 8:57 AM

Can somebody give me a simple code to return data to a list (next available Row,Column,Cell) using a UserForm (textbox). I basically need input from the user and the Data Form won't work for this function. Any help would be greatly appreciated. Thanks!!!

Posted by Tom Dickinson on December 14, 2001 9:19 AM

I'm not sure what you mean by the next available Row,Column,Cell; but the following will give you an idea what to do:

Sub PutItThere()
Dim Cnt1, Cnt2 as Integer
Cnt1 = 0
Cnt2 = 0
Do While Range("A1").Offset(Cnt1) <> Empty
Cnt1 = Cnt1 + 1
Loop
Do While Range("A1").Offset(Cnt1, Cnt2) <> Empty
Cnt2 = Cnt2 + 1
Loop
Range("A1").Offset(Cnt1, Cnt2) = TextBox1
End Sub

The first do loop looks by row, the second is by column.

Hope this helps.



Posted by Jon Eubanks on December 14, 2001 11:41 AM

Thanks so much for your help!!!!!!!!
One more question: how can I do the exact same thing but return the value of textbox1 to another sheet?