View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Vba add data to cell from userform

Adrian,

It works in my tests. Are you sure your listboxes haven't been renamed from
the default?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"adrian" wrote in message
...
Bob,

I am getting a runtime error 1004
Application-defined or object-defined error

Come up when this code is run.

I have your code set as a commandbutton click event.
Eveything else seems to be OK
Any ideas what it could be?

Thanks for any further help you can offer

Adrian

-----Original Message-----
Thanks bob, just the job

adrian
-----Original Message-----

With Range("A" & Cells(Rows.Count,"A").End

(xlUp).Row+1)
.Offset(0,0).Value = Listbox1.Value
.Offset(0,1).Value = Listbox2.Value
.Offset(0,2).Value = Listbox3.Value
.Offset(0,3).Value = Listbox4.Value
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"adrian" wrote in

message
.. .
Hi all,

I am new to Exell but have been tinkering with VBA in

Word.
I would be very grateful if someone could set me off in
the right direction with this little task.

I have a userform that has 4 listboxes in.

Any suggestions on how best to code exell so the the
result from each of the listboxes are entered into
worksheet cells on the next available row.

ie
Listbox1 result = "Dog"
Listbox2 result = "Cat"

Find first row with no data added. Add "Dog" to cell ?

1.
Add "Cat" to cell ?2 etc etc.

Any help with code would be much appreciated.

Adrian


.

.