RECORDING & RUNNING MACROS

aasife

New Member
Joined
Jan 3, 2005
Messages
4
I recorded a macro containing functions on different columns and rows.

Like, the first function is recorded under column "C" and Last under "K".

If I run the macro by putting the cursor under column "D", the data for column "C" does not appear / calculated by the macro.

Please advise. :confused:
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Not too sure what you are doing. Macro recording is just recording events. When you play it back the exact same thing will happen.
So if when you recorded you made your changes in column C they will happen in column C when you play back.
 
Upvote 0
I recorded a macro containing functions on different columns and rows.

Like, the first function is recorded under column "C" and Last under "K".

If I run the macro by putting the cursor under column "D", the data for column "C" does not appear / calculated by the macro.

Please advise. :confused:
Perhaps you could paste the recorded macro code on the board and explain what you want it to do?
 
Upvote 0
Here it is Peter. I need this to extract data from various woorkbooks/sheets using vlookup function.

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[7],ZINV.XLS!C1:C10,5,0)"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C245")
Range("C2:C245").Select
Range("C2").Select
Calculate
Range("C2").Select
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[6],ZINV.XLS!C1:C10,6,0)"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D245")
Range("D2:D245").Select
Range("D2").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Garamond"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 55
End With
Range("I2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[1],ZINV.XLS!R1:R65536,2,0)"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[1],ZINV.XLS!R1:R65536,10,0)"
Range("I2").Select
Selection.AutoFill Destination:=Range("I2:I245")
Range("I2:I245").Select
Range("K2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],ZINV.XLS!R1:R65536,2,0)"
Range("K2").Select
Selection.AutoFill Destination:=Range("K2:K245")
Range("K2:K245").Select
Range("C2:D245").Select
Selection.Copy
ActiveWindow.ScrollRow = 160
ActiveWindow.ScrollRow = 59
ActiveWindow.ScrollRow = 1
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("I2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("I2:I245").Select
ActiveWindow.ScrollRow = 188
ActiveWindow.ScrollRow = 145
ActiveWindow.ScrollRow = 131
ActiveWindow.ScrollRow = 102
ActiveWindow.ScrollRow = 73
ActiveWindow.ScrollRow = 44
ActiveWindow.ScrollRow = 1
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.ScrollRow = 188
ActiveWindow.ScrollRow = 174
ActiveWindow.ScrollRow = 145
ActiveWindow.ScrollRow = 102
ActiveWindow.ScrollRow = 44
ActiveWindow.ScrollRow = 1
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("L2").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

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