Hello All,
I have tables of the same structure on several tabs in a workbook, which I update monthly. I normally record a macro on one of the tables and then run it on all the other ones (I even put it into a loop so that I don`t have to run it on all the tabs one by one). The macro starts with a copy paste command and then there are replacements made (see macro below).
My issue is that when I now try to run the recorded macro on another tab, it takes the values from the original tab, instead of taking them from the tab I am on. I guess this is related the basic settings of Excel...does anyone know what is causing this?
Sub milli()
'
' milli Macro
'
' Keyboard Shortcut: Ctrl+m
'
ActiveCell.Offset(0, -2).Range("A1:A9").Select
Selection.Copy
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.Replace What:="Mar", Replacement:="Apr", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
ActiveCell.Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "='Apr-15'!R12C8"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Apr-15'!R12C9"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Apr-15'!R12C10"
ActiveCell.Offset(-1, 0).Range("A1").Select
End Sub
Bookmarks