Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Dim LR As Long LR = Range("A" & Rows.Count).End(xlUp).Row 'open the csv file and begin formatting the data 'the following line is commented out when running it from within the csv file 'but is un-commented when I run it from the external workbook 'Workbooks.Open Filename:="F:\Folder\File.csv" 'shift column M to the right Columns("M:M").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove 'insert formula into M2 Range("M2").Select ActiveCell.FormulaR1C1 = "=IF(RC[-1]=0,""No"",""Yes"")" 'paste the formula down column M to the last populated cell Range("M2").AutoFill Destination:=Range("M2:M" & LR) 'copy header from L1 to M1 Range("L1").Select Selection.Copy Range("M1").Select ActiveSheet.Paste Range("A2").Select 'turn off alerts to save over the existing file Application.DisplayAlerts = False 'save the csv file as an xlsx file ChDir "F:\Folder" ActiveWorkbook.SaveAs Filename:="F:\Folder\File.xlsx", _ FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False 'turn on alerts again Application.DisplayAlerts = True 'close the workbook Workbooks("File.xlsx").Close 'exit Excel Application.Quit
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Compare Excel spreadsheet question.||2||24|
|Check whether selected cells contain a certain fill color||5||29|
|Help to break down spreadsheet||3||40|
|Access Excel ADO SQL question||8||9|