M
MCheru
I am using the codes below to link cells specific cells in Column B from a
worksheet called Summary to specific cells in Column C and Column D in a
worksheet called Report. As you can see the codes I have are very long. Is
there a way to make them shorter?
Sub ColumnCMacro()
Range("C2").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C3").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C5").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C6").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C7").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C8").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C9").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C10").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C11").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C12").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C13").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C14").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C15").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C16").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C19").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C20").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C22").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C23").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C24").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C25").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C26").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C27").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C28").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C29").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C30").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C31").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C32").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C33").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C36").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C37").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C39").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C40").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C41").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C42").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C43").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C44").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C45").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C46").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C47").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C48").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C49").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C50").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C51").Select
Range("A1:L1").Select
End Sub
Sub ColumnDMacro()
Range("D2").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D3").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D5").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D6").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D7").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D8").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D9").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D10").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D11").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D12").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D13").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D14").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D15").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D16").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D19").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D20").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D22").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D23").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D24").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D25").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D26").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D27").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D28").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D29").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D30").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D31").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D32").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D33").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D36").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D37").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D39").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D40").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D41").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D42").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D43").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D44").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D45").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D46").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D47").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D48").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D49").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D50").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D51").Select
Range("A1:L1").Select
End Sub
worksheet called Summary to specific cells in Column C and Column D in a
worksheet called Report. As you can see the codes I have are very long. Is
there a way to make them shorter?
Sub ColumnCMacro()
Range("C2").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C3").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C5").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C6").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C7").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C8").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C9").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C10").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C11").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C12").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C13").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C14").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C15").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C16").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C19").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C20").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C22").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C23").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C24").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C25").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C26").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C27").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C28").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C29").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C30").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C31").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C32").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C33").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C36").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C37").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C39").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C40").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C41").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C42").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C43").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C44").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C45").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C46").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C47").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C48").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C49").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C50").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-1]"
Range("C51").Select
Range("A1:L1").Select
End Sub
Sub ColumnDMacro()
Range("D2").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D3").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D5").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D6").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D7").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D8").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D9").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D10").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D11").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D12").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D13").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D14").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D15").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D16").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D19").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D20").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D22").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D23").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D24").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D25").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D26").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D27").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D28").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D29").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D30").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D31").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D32").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D33").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D36").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D37").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D39").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D40").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D41").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D42").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D43").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D44").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D45").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D46").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D47").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D48").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D49").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D50").Select
ActiveCell.FormulaR1C1 = "='Summary'!RC[-2]"
Range("D51").Select
Range("A1:L1").Select
End Sub