UserForm Data to Spreadsheet

A

Andy Tallent

Is it possible when writing Userform data elements to a spreadsheet to
specify exactly the cell you want the first piece of data to populate. I
have tried a number of methods which allocate the data to the first available
free cell or row but this is not exactly what I want to do here.

For example, I would like to specify Cell "C4" to receive the first piece of
data from the userform with subsequent pieces of data from that submission
populating "D4,E4,F4" etc. The next time data is submitted from the Userform
I would like it to start at "C5". Sorry for this lengthy explanation but any
help would be very much appreciated.

Kindest regards as always.
 
T

Tom Ogilvy

You would need to use code to write the data. It is unclear how you would
specify the location, but once you have that established, the code would
just be written to address a relative location to the specified cell.

Private Sub Commandbutton1_click()
Dim rng as Range
on Error Resume Next
set rng = application.Inputbox("select destination cell using mouse",
type:=8)
On Error goto 0
if not rng is nothing then
textbox1.Text = rng.Value
textbox2.Text = rng.offset(0,1).Value
textbox3.Text = rng.offset(0,2).Value
end if
Next
 
A

Andy Tallent

Thank you Tom,

I reversed "textbox1.Text = rng.Value" to read "rng.Value = textbox1.Text"
and it worked a treat, thank you very much for the help.
 
Top