How do I create a macro in excel that varies depending on the cell?
I am working on a workbook in excel that has several worksheets within it. On the last page I have created a template to be filled in from numbers on the previous page. The numbers will be taken from all 12 of the previous pages. However, I would like to be able to select a different cells at will to perform this action on. i.e. Sometimes on the first name on the list, sometimes on the last name. How do I do this? I hope I explained this well. If not ask.
Range("B5").Select
ActiveCell.FormulaR1C1 = "=January!R[-2]C[1]"
Range("B6").Select
ActiveCell.FormulaR1C1 = "=January!R[-5]C[2]"
Range("B7").Select
ActiveCell.FormulaR1C1 = "=January!R[-4]C[-1]"
Range("B10").Select
ActiveCell.FormulaR1C1 = "=January!R[-7]C[6]"
Range("B11").Select
ActiveCell.FormulaR1C1 = "=February!R[-8]C[6]"
Range("B12").Select
ActiveCell.FormulaR1C1 = "=March!R[-9]C[6]"
Range("B13").Select
ActiveCell.FormulaR1C1 = "=April!R[-10]C[6]"
Range("B14").Select
ActiveCell.FormulaR1C1 = "=May!R[-11]C[6]"
Range("B15").Select
ActiveCell.FormulaR1C1 = "=June!R[-12]C[6]"
Range("B16").Select
ActiveCell.FormulaR1C1 = "=July!R[-13]C[6]"
Range("B17").Select
ActiveCell.FormulaR1C1 = "=Aug!R[-14]C[6]"
Range("B18").Select
ActiveCell.FormulaR1C1 = "=Sep!R[-15]C[6]"
Range("B19").Select
ActiveCell.FormulaR1C1 = "=Oct!R[-16]C[6]"
Range("B20").Select
Active
Thanks devilish. This is my first macro, so some of this went over my head. I simply recorded that code. So doing this in VBS is kinda difficult. If you could simplify that would be great. ha sorry