LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Macro should Save and Overwrite file

Hi
This macro should run and just overwrite the original file. However when you
run it - it asks if you wish to save changes to "bcms_1002.xlsm" if you
click cancel the macro completes fine.
I need it to just run and save without this prompt.
Can someone please check my code?
Would be really appreciated.
Many thanks.


Sub bcms1002()
'
' bcms1002 Macro
'

'
Set NewSht = ThisWorkbook.ActiveSheet
ChDir "Y:\"
Set CSVFile =
Workbooks.Open(Filename:="Y:\report_list_bcms_agen t_1002_.csv")
CSVFile.ActiveSheet.Range("A1:U20").Copy _
Destination:=NewSht.Range("A1")
Application.CutCopyMode = False
CSVFile.Close
Range("A1").Select
ActiveWorkbook.Close
Rows("1:3").Select
Range("A3").Activate
Selection.Delete Shift:=xlUp
Cells.Select
Cells.EntireColumn.AutoFit
Rows("17:18").Select
Selection.Delete Shift:=xlUp
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("E1:E16").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:=xlDelimited,
_
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar
_
:="-", FieldInfo:=Array(Array(1, 1), Array(2, 1)),
TrailingMinusNumbers:=True
Columns("F:F").Select
Selection.Delete Shift:=xlToLeft
Cells.Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("C:H").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.ColumnWidth = 10
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Range("A1:A16").Select
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
OtherChar:="-", FieldInfo:=Array(Array(0, 1), Array(5, 1), Array(8,
1), Array(13, _
1), Array(17, 1), Array(19, 1)), TrailingMinusNumbers:=True
Columns("A:C").Select
Range("C1").Activate
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("D1").Select
Sheets("Sheet2").Select
ActiveCell.FormulaR1C1 = "JAN"
Range("A2").Select
ActiveCell.FormulaR1C1 = "FEB"
Range("A3").Select
ActiveCell.FormulaR1C1 = "MAR"
Range("A1:A3").Select
Selection.AutoFill Destination:=Range("A1:A12"), Type:=xlFillDefault
Range("A1:A12").Select
Range("B1").Select
ActiveCell.FormulaR1C1 = "1"
Range("B2").Select
ActiveCell.FormulaR1C1 = "2"
Range("B3").Select
ActiveCell.FormulaR1C1 = "3"
Range("B1:B3").Select
Selection.AutoFill Destination:=Range("B1:B12"), Type:=xlFillDefault
Range("B1:B12").Select
Range("A1").Select
Sheets("Sheet1").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],Sheet2!R1C1:R12C2,2,FALSE)"
Selection.AutoFill Destination:=Range("D1:D16")
Range("D1:D16").Select
Columns("D:D").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Range("D1").Select
ActiveCell.FormulaR1C1 = "=DATE(RC[-2],RC[-1],RC[-3])"
Range("D1").Select
Selection.AutoFill Destination:=Range("D1:D16")
Range("D1:D16").Select
Columns("D:D").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Columns("A:C").Select
Range("C1").Activate
Selection.Delete Shift:=xlToLeft
Columns("A:A").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("A:M").Select
Selection.ColumnWidth = 28.71
Range("A1").Select
ActiveCell.FormulaR1C1 = "DATE"
Range("B1").Select
ActiveCell.FormulaR1C1 = "LOGIN"
Range("C1").Select
ActiveCell.FormulaR1C1 = "NAME"
Range("D1").Select
ActiveCell.FormulaR1C1 = "TIME"
Range("E1").Select
ActiveCell.FormulaR1C1 = "ACD CALLS"
Range("F1").Select
ActiveCell.FormulaR1C1 = "AVG TALK TIME"
Range("G1").Select
ActiveCell.FormulaR1C1 = "TOTAL AFTER CALL"
Range("H1").Select
ActiveCell.FormulaR1C1 = "TOTAL AVAIL"
Range("I1").Select
ActiveCell.FormulaR1C1 = "TOTAL AUX"
Range("J1").Select
ActiveCell.FormulaR1C1 = "EXTN CALLS"
Range("K1").Select
ActiveCell.FormulaR1C1 = "AVG EXTN TIME"
Range("L1").Select
ActiveCell.FormulaR1C1 = "TOTAL STAFFED"
Range("M1").Select
ActiveCell.FormulaR1C1 = "TOTAL HOLD"
Cells.Select
Cells.EntireColumn.AutoFit
With Selection.Font
.Name = "Calibri"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="Y:\bcms_1002.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Application.DisplayAlerts = True
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save a file and overwrite existing file Daniel M Excel Programming 1 January 18th 08 07:45 PM
How to save a file without overwrite or save a copy? SettingChange Setting up and Configuration of Excel 1 November 3rd 05 02:10 AM
Excel prompts me to save a copy or overwrite file. Vinny Excel Worksheet Functions 0 May 20th 05 03:05 PM
Save As Overwrite [email protected] Excel Programming 1 September 15th 04 11:09 PM
Save .csv with overwrite Kevin Excel Programming 1 April 27th 04 02:38 AM


All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"