DrChu

New Member
Joined
Mar 20, 2019
Messages
2
Hey guys,

I get extensive daily reports in the form of workbooks with multiple sheets. I have a master workbook with multiple sheets as well. We operate by shift numbers.

In the master workbook, I have shift numbers in columns. For example, row 8 is shift 5, row 9 is shift 6, row 10 is shift 7 and so on.

For example, I have data in C4:K4 that all have different cell references in the shift report #4 . I want the same cells to be referenced, one row down, but from a different workbook, shift #5 .
Right now, I copy down the formulas and change the source name manually, which is quite time consuming as I have to do this for 50+ cells across multiple worksheets. All of the reports I get are named after their shift numbers.

Here is what I do, in code form.

Code:
Sub update()'
' update Macro
'


'
    Range("B8:F8").Select
    Selection.AutoFill Destination:=Range("B8:F9"), Type:=xlFillDefault
    Range("B8:F9").Select
    Range("B9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R15C2"
    Range("C9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R17C2"
    Range("D9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R16C2"
    Range("E9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R18C2"
    Range("F9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R10C8"
    Range("I8").Select
    Selection.AutoFill Destination:=Range("I8:I9"), Type:=xlFillDefault
    Range("I8:I9").Select
    Range("I9").Select
    ActiveCell.FormulaR1C1 = _
        "='C:\Users\owner\Desktop\Shift Reports\2019 SR\[5.xlsx]SUMMARY REPORT'!R16C8"
    Range("I10").Select
End Sub

This is only the code for one of the sheets, but an answer here would help me immensely for the bigger macro I'm hoping to create.

There has to be a way to make the [S#] a variable? In Column B of that sheet, I have the shift #. For example, Cell B8 has the value of "5", the shift number of the data appearing in that row. I'm just lost as to how to do it.

Thanks for your time.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,214,825
Messages
6,121,787
Members
449,049
Latest member
greyangel23

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