Macros not running properly. Can anyone assist?

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
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
 

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
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:
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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