Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filling rows
The worksheet where the data is residing is called "Master
Employee" and I need to copy every row onto a worksheet called "Labels". Every row copied will fill in 10 rows on the "labels" worksheet. Both the wkshts have the same column headings. I have data on Master Employee and need to copy to Labels. Master Employee!A1 to A1:A10 on Labels Master Employee!A2 to A11:A20 on Labels Master Employee!A3 to A21:A30 on Labels Master Employee!A4 to A31:A40 on Labels and so on. Help!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filling rows
I'm not sure exactly what you wanted. So, I created two
varieties. I think you want the second variety. Check and see if one of these work for you. I didn't completely check them, but I think they're OK. Note, for these samples, the first row is 1 and the last row is 10 in the Master Employees sheet. Just change these variables to fit your requirements. The first variety allows for 10 columns (fields) of data per row, in the Master Employee sheet. These are copied to the Labels sheet in column A in groups of 10. The second variety allows for only one column of data (column A) in each row as found on the Master Employee Sheet. This one item is copied to the Labels sheet in groups of 10 also. Sub EmployeeLabelsVar1() Dim i As Long Dim j As Byte Dim FirstRow As Integer, LastRow As Integer Dim S1 As Worksheet, S2 As Worksheet Dim Count As Integer Set S1 = Sheets("Master Employee") Set S2 = Sheets("Labels") FirstRow = 1 LastRow = 10 Count = 0 For i = FirstRow To LastRow For j = 1 To 10 S2.Cells(j + Count, 1).Value = _ S1.Cells(i, j).Value Next j Count = Count + 10 Next i End Sub Sub EmployeeLabelsVar2() Dim i As Long Dim j As Byte Dim FirstRow As Integer, LastRow As Integer Dim S1 As Worksheet, S2 As Worksheet Dim Count As Integer Set S1 = Sheets("Master Employee") Set S2 = Sheets("Labels") FirstRow = 1 LastRow = 10 Count = 0 For i = FirstRow To LastRow For j = 1 To 10 S2.Cells(j + Count, 1).Value = _ S1.Cells(i, 1).Value Next j Count = Count + 10 Next i End Sub -----Original Message----- The worksheet where the data is residing is called "Master Employee" and I need to copy every row onto a worksheet called "Labels". Every row copied will fill in 10 rows on the "labels" worksheet. Both the wkshts have the same column headings. I have data on Master Employee and need to copy to Labels. Master Employee!A1 to A1:A10 on Labels Master Employee!A2 to A11:A20 on Labels Master Employee!A3 to A21:A30 on Labels Master Employee!A4 to A31:A40 on Labels and so on. Help!! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
filling a single cell before the sum of the previous rows. | Excel Discussion (Misc queries) | |||
FILLING A RANGE WITH SAME CHARACTERS INVOLVING HIDDED ROWS | Excel Discussion (Misc queries) | |||
Filling only cells for rows with content | Excel Worksheet Functions | |||
Filling in blank rows | Excel Discussion (Misc queries) | |||
auto filling columns from rows | Excel Discussion (Misc queries) |