VBA Code works on TSR sheet but exact code does not work on FSL sheet

martinrall

New Member
Joined
Dec 12, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Sheets both have the same number of columns and same type of data FSL throws a 400. How could this be?

VBA Code:
'TSR
Set wb1 = Workbooks.Open(mypath)
    wb1.Sheets("TSR").Columns("AB:AB").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Selection.Copy
    wb1.Sheets("TSR").Columns("AB:AB").Select
    wb1.Sheets("TSR").Paste
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
     
'FSL
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AB:AB").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AC:AC").Select
    Selection.Copy
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AB:AB").Select
    wb1.Sheets("FSL-PARTS DROPS - CORE").Paste
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AC:AC").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    wb1.Sheets("FSL PARTS DROPS").Columns("AC:AC").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFr
omLeftOrAbove
[/CODE]
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Sheets both have the same number of columns and same type of data FSL throws a 400. How could this be?

VBA Code:
'TSR
Set wb1 = Workbooks.Open(mypath)
    wb1.Sheets("TSR").Columns("AB:AB").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Selection.Copy
    wb1.Sheets("TSR").Columns("AB:AB").Select
    wb1.Sheets("TSR").Paste
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    wb1.Sheets("TSR").Columns("AC:AC").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    
'FSL
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AB:AB").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AC:AC").Select
    Selection.Copy
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AB:AB").Select
    wb1.Sheets("FSL-PARTS DROPS - CORE").Paste
    wb1.Sheets("FSL-PARTS DROPS - CORE").Columns("AC:AC").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    wb1.Sheets("FSL PARTS DROPS").Columns("AC:AC").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFr
omLeftOrAbove
[/CODE]
i fixed the last sheet reference to FSL-PARTS DROPS - CORE
 
Upvote 0

Forum statistics

Threads
1,215,412
Messages
6,124,761
Members
449,187
Latest member
hermansoa

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