Copying rows to new sheet referencing master

SPABS

New Member
Joined
Jan 11, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there, first post so hopefully I am doing this correctly.

I am trying to create a process with another program (Revit) for creating formatted schedules (tables). I have plugins that update parameters in our program with an excel file and back.

Basically, I want to have a master sheet and copy each row to a new sheet. I have that and have it works, but I want those copied values to equal the master if it changes and that's the part I am struggling with. This is what I have now.

VBA Code:
Sub RowToSheet()
Dim xRow As Long
    Dim i As Long
    With ActiveSheet
        xRow = .Range("A" & Rows.Count).End(xlUp).Row
        For i = 1 To xRow
            Worksheets.Add(, Sheets(Sheets.Count)).Name = "Row " & i
            .Rows(2).Copy Sheets("Row " & i).Range("A1")
            .Rows(i).Copy Sheets("Row " & i).Range("A2")
        Next i
    End With
End Sub

For reference, the master from the sample I am using now has 517 rows with 168 columns and when I make the 517 sheets, I want all values to equal the first if it updates so that I can have tables that play nice with the first program.

Hopefully that makes any sense.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try this

VBA Code:
Sub RowToSheet()
    Dim xRow As Long
    Dim i As Long
    With ActiveSheet
        xRow = .Range("A" & Rows.Count).End(xlUp).Row
        For i = 1 To xRow
            Worksheets.Add(, Sheets(Sheets.Count)).Name = "Row " & i
            ' Fill the values in new sheet with formula to reference corresponding cell in the master sheet
            Sheets("Row " & i).Range("A1:A" & Columns.Count).Formula = "=INDIRECT(""Sheet1!""&ADDRESS(ROW(),COLUMN()))"
            .Rows(i).Copy Sheets("Row " & i).Range("A2")
        Next i
    End With
End Sub
 
Upvote 0
Try this

VBA Code:
Sub RowToSheet()
    Dim xRow As Long
    Dim i As Long
    With ActiveSheet
        xRow = .Range("A" & Rows.Count).End(xlUp).Row
        For i = 1 To xRow
            Worksheets.Add(, Sheets(Sheets.Count)).Name = "Row " & i
            ' Fill the values in new sheet with formula to reference corresponding cell in the master sheet
            Sheets("Row " & i).Range("A1:A" & Columns.Count).Formula = "=INDIRECT(""Sheet1!""&ADDRESS(ROW(),COLUMN()))"
            .Rows(i).Copy Sheets("Row " & i).Range("A2")
        Next i
    End With
End Sub
Not quite unfortunately, it basically just gave me the result I had before minus some other information. I'll try to show off a bit more of what I am trying to do so others can see as well. So exporting from revit gives me this spreadsheet.
1673469159137.png

And what I have done made a sheet for each row
1673469413475.png

But if I change C5 n the master it doesn't change on its new sheet. Technically it is fine, but ideally I want to be able to be able to update it without redoing my formatted tables.
1673469666781.png


The code you linked did try to reference, but it referenced everything on the entire document each time and still left it as a pasted value rather than a referenced value/formula.

1673469888427.png


While what I am trying to do is more like this

1673469945534.png


I just don't want to do this 514 times haha.

Thank you for replying! Really apprciated.
 

Attachments

  • 1673469595950.png
    1673469595950.png
    35.6 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top