ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to copy values to another sheet (https://www.excelbanter.com/excel-programming/303085-how-copy-values-another-sheet.html)

C. Thies

how to copy values to another sheet
 
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!



David Adamson[_3_]

how to copy values to another sheet
 
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

"C. Thies" wrote in message
...
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!






All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com