What does error 400 mean?!?!?!?? Macro/VBA issues...

mimih23

Board Regular
Joined
Oct 14, 2010
Messages
89
Created a relatively simple macro and can't seem to get past the first 4 lines. Can anyone see what could be the potential problem with my macro below? It for some reason will not move on to the next tab which is Report 2 consistently. Help please.

Thanks!

Sub Clean_PayFac()
'
' Clean_PayFac Macro
' Clean initial pull, add columns, etc.
'
'
Rows("1:3").Select
Selection.Delete Shift:=xlUp
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft (it seems to stop right here)
Sheets("Report 2").Select
Rows("1:2").Select
Selection.Delete Shift:=xlUp
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Sheets(Array("Report 1", "Report 2")).Select
Sheets("Report 2").Activate
Cells.Select
Cells.EntireColumn.AutoFit
Sheets("Report 1").Select
Columns("F:F").Select
Selection.Copy
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("D1").Select
ActiveCell.FormulaR1C1 = "Federal Tax ID"
Columns("E:E").Select
Range("E1").Select
ActiveCell.FormulaR1C1 = "Legal Name"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Store Name"
Columns("G:G").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("G1").Select
ActiveCell.FormulaR1C1 = "Store Number"
Columns("G:G").Select
Columns("G:G").EntireColumn.AutoFit
Range("H1").Select
ActiveCell.FormulaR1C1 = "MID DBA Name"
Columns("J:J").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("J1").Select
ActiveCell.FormulaR1C1 = "Merchant Open Date"
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("L:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
Range("L1").Select
ActiveCell.FormulaR1C1 = "Basic Merchant Settlement"
Range("M1").Select
ActiveCell.FormulaR1C1 = "Basic Settlement R&T Bank Name"
Range("N1").Select
ActiveCell.FormulaR1C1 = "Advanced Settlement Option"
Range("O1").Select
ActiveCell.FormulaR1C1 = "Advanced Routing & Transit Bank Name"
Range("P1").Select
ActiveCell.FormulaR1C1 = "Advanced Deposit DDA"
Range("P1").Select
ActiveCell.FormulaR1C1 = "Advanced Settlement Deposit DDA"
Sheets(Array("Report 1", "Report 2")).Select
Sheets("Report 2").Activate
Cells.Select
Cells.EntireColumn.AutoFit
Sheets("Report 1").Select
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
400 means an action is being called for, but the action doesn't apply to the object for which it is be asked to act upon.

This is syntactically correct; though manic to read

Code:
[COLOR=#333333]Rows("1:3").Select[/COLOR]
[COLOR=#333333]Selection.Delete Shift:=xlUp[/COLOR]
[COLOR=#333333]Columns("A:A").Select[/COLOR]
[COLOR=#333333]Selection.Delete Shift:=xlToLeft (it seems to stop right here)[/COLOR]
[COLOR=#333333]Sheets("Report 2").Select
[/COLOR]

Does it stop here
Selection.Delete Shift:=xlToLeft
or here
Sheets("Report 2").Select
?

Which line is highlighted?
If the latter, verify that "Report 2" is indeed the name.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,576
Members
448,972
Latest member
Shantanu2024

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