how to copy values to another sheet

C

C. Thies

Hi

I am trying to copy the contents of the values selected in several
comboboxes and textboxes in a form to consecutive lines in a sheet

Anyone know where can I find examples for doing this?

Thanks!
 
D

David Adamson

This is assuming that you are developing a database and need to record
details from several entries



Dim y As Control



For c = 1 to 20 ' assuming 20 pieces of info to return



'set name of worksheet to return data to

With Worksheets("Sheet Name")

'finds the next row available

Set rng = .Cells(Rows.Count, 1).End(xlUp)(2)

'format

'data location to return to: all the data entry names on your user form go
y1, y2 . y20

rng(1, c).Value = Controls("y" & x)





'if they don't then you have to do the following (where items is the name
of the textbox etc

rng(1,1).value = items.value

rng(1,2).value = items2.value





If not using a database and only want the number returned once then adapt
the following

'this returns a 5*9 matrix of numbers



Dim y As Control

Dim i, j, x As Integer



x = 1

For i = 1 To 10

For j = 1 To 5

Worksheets("Assumptions").Cells(i + 4, j + 1) = Controls("y" &
x)

x = x + 1

Next j

Next i
 
Top