Macros not running properly. Can anyone assist?

ghrek

Board Regular
Joined
Jul 29, 2005
Messages
171
Hi

I have a workbook and run this macro first OK

Sub Split_Extract()

ActiveSheet.Name = "Extract"
Range("A1").Select

Cells.Find(What:="WFJ", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Cut
Range("H2").Select
ActiveSheet.Paste
Range("A1:E1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
Application.CutCopyMode = False

End Sub

Once I done that I try to run a 2nd macro and this is when I get the issues. I get runtime error 1004 Method range of object global failed.

2nd Macro shown below. Any Ideas?

Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=IF([@Source]="""","""",IF(ISNA(MATCH([@ID]&[@Field2]&[@Date]&[@Value],INDEX(R2C9:R104C9&R2C10:R104C10&R2C11:R104C11&R2C12:R104C12,),0)),""MISSING"",""""))"
Range("F2").Select
Selection.AutoFill Destination:=Range("Table2[Column1]") <---------------- when running debugger this is where line highlighted.
Range("Table2[Column1]").Select
End Sub
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,342
Am no VBA expert by any means but this looks odd to me...
Are you sure these should be in quotes?

Selection.AutoFill Destination:=Range("Table2[Column1]") <---------------- when running debugger this is where line highlighted.
Range("Table2[Column1]").Select

UPDATE: Oh yep, seems to work!
What happens if you replace "Table2[Column1]" with the actual cell references the table refers to?
If the macro works it would imply you can't put a Table/Column reference in a Range using AutoFill Destination
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,099,683
Messages
5,470,108
Members
406,681
Latest member
sachinmasurkar

This Week's Hot Topics

Top