View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default copying and pasting two rows of formulas every other line

Bob,

Something is wrong about your description. If you are actually using two columns to display each of
the rows from your table, you would have run out of columns (Excel only has 256 columns - so you
could only display 128 sets of data). I think you mean that you have three columns, using two rows
to show each of the rows from your table.

If that is the case, put this into cell A1:

=INDEX('#1workbook'!$A$1:$F$400,INT((ROW()-ROW($A$1))/2)+1,MOD((ROW()-ROW($A$1)),2)*3+COLUMN()-COLUMN($A$1)+1)

and copy to B1:C1, then copy A1:C1 down as far as you need.

If I'm wrong (which I am often) put this formula into cell A1

=INDEX('#1workbook'!$A$1:$F$400,INT((COLUMN()-COLUMN($A$1))/2)+1,MOD((COLUMN()-COLUMN($A$1)),2)*3+ROW()-ROW($A$1)+1)

and copy to A2:A3, then copy A1:A3 across until you run out of columns.

HTH,
Bernie
MS Excel MVP


"rjr" wrote in message
.. .
Hello, I am in Excel 2003 and have a worksheet consisting of data in row 1 and row 2 that go
together. An example would be
A1 (employee name) A2 (Employee address A3 (Employee city/state/zip)
B1 (employee SSN) B2 (Wages owed to employee) B3 (Interest owed to employee)

Each of these cells are linked to another worksheet that the data is entered into but each person
only has one row of data. The worksheet that I'm working in is a protected worksheet where it
retrieves this data from the worksheet and displays it in a report view.

My problem: I have space for 134 names now (total 268 rows as two rows are used for one employee)
and need to add 166 additional names to the worksheet. That means 332 rows that have formulas
increasing the link to worksheet 1 by 1.

Example: a1 (=#1workbook!A1) a2 ((=#1workbook!A2) a3 (=#1workbook!A3) b1 (=#1workbook!A4)
b2(=#1workbook!A5) b3(=#1workbook!A6) ** next group
c1 (=#1workbook!b1) c2 ((=#1workbook!b2) c3 (=#1workbook!b3) d1
(=#1workbook!b4) d2(=#1workbook!b5) d3(=#1workbook!b6) and continues on.

Can anyone help me with a macro to add copy the values in the last example in both rows and paste
them with an automatic increase of the values by one....

I have the worksheet unprotected and for some reason can't get the paste function to work either
by keyboard or by pull down, any ideas on this????

Hope this is clear enough if not let me know and thanks in advance
Bob Reynolds