I have a bit of code tied to a command button in Access that runs a
query then transfers it to a new Excel worksheet (& new file). It
works fine EVERY OTHER
TIME THAT I RUN IT....what the 'heck is going on? I get the following
error message on the odd runs:
Run-Time Error 1004
Method 'Columns' of object '_Global' failed
.....the query results make it to the worksheet. The error occurs in my
section
of code that formats the worksheet once the data has been imported. I
have copied the applicable section of data below:
THIS IS WHERE I GET THE ERROR (EVERY OTHER TIME THAT I RUN IT)
Columns("A:A").EntireColumn.AutoFit
Rows("1:6").Select
Selection.Insert Shift:=xlDown
Range("A6").Select
ActiveCell.FormulaR1C1 = "Group Name"
Range("B6").Select
ActiveCell.FormulaR1C1 = "FSC"
Range("B6").Select
ActiveCell.FormulaR1C1 = "FSC #"
....and so on.
Is there something I need to define beforehand? Any assistance w/ this
would be GREATLY appreciated (I can't afford to lose anymore hair).