Originally Posted by
freud1
Sub LinkMacro()
'
' LinkMacro Macro
' Macro recorded 24/06/2008 by Levi
'
Dim OutSH As Worksheet
'assign output sheet to variable
Set OutSH = Sheets("Sheet1")
'initialize the data output row
outrow = 3
'nominate the data action sheet
With Sheets("LinkDetails")
'loop through the items in column A of the data sheet
For Each ce In .Range("A1:A" & .Cells(Rows.Count, 1).End(xlUp).Row)
'insert the formula into the first output cell
OutSH.Cells(outrow, 1).Formula = "='" & ce.Value & ce.Offset(0, 1).Value & ce.Offset(0, 2).Value & ce.Offset(0, 3).Value & ce.Offset(0, 4).Value & ce.Offset(0, 5).Value & ce.Offset(0, 6).Value
'autofill the first column output block with the formula
OutSH.Cells(outrow, 1).AutoFill Destination:=OutSH.Range(OutSH.Cells(outrow, 1), OutSH.Cells(outrow + 299, 1))
'increment the output row
outrow = outrow + 300
Next ce
End With
'activate the output sheet
OutSH.Activate
'determine the last row of formulas
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
'autofill from column A across to column L
Range("A3:A" & lastrow).AutoFill Destination:=Range("A3:H" & lastrow)
'
'
Range("A2:H3002").Sort Key1:=Range("H3"), Order1:=xlDescending, Key2:= _
Range("A3"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
End Sub
Bookmarks