![]() |
Need help with Macro
I am having difficulties getting my macro to work properly. I have a sheet of data that I am updating with NEW data each month (overwritting the previous months data) and I want that data to be automatically put into sheets that correspond to the a account number that is assigned in Sheet 1. I have started a macro, but when I try and run it with new data, the old data is overwritten. I'm not sure how to make it go to the next active cell in that column. Below is my script:
Sub Test2() ' ' Test2 Macro ' ' Range("B2").Select Application.CutCopyMode = False ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Data!C[-1]:C[5],2,FALSE)" Range("C2").Select ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],Data!C[-2]:C[4],3,FALSE)" Range("C3").Select ActiveCell.FormulaR1C1 = "" Range("D2").Select ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],Data!C[-3]:C[3],4,FALSE)" Range("E2").Select ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-4],Data!C[-4]:C[3],5,FALSE)" Range("F2").Select ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-5],Data!C[-5]:C[1],6,FALSE)" Range("G2").Select ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-6],Data!C[-6]:C,7,FALSE)" Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("A3").Select End Sub Can anyone help? Also, I'm interested in how I make this macro apply for all sheets within my workbook. Thank you! |
All times are GMT +1. The time now is 02:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com