' CLEAR SHEETS READY FOR NEW DATA
Sheets("Sheet1").Select
Cells.Select
Selection.Delete Shift:=xlUp
Range("A1").Select
'Switch off Screen updating
Application.ScreenUpdating = False
' OPEN A FILE
SOURCEFILE = Application.GetOpenFilename("TEXT files(*.csv),DAILYOUTPUT.CSV", , "Select the FILE for checking")
If SOURCEFILE = "False" Then Exit Sub
Workbooks.Open Filename:=SOURCEFILE
Cells(1, 1).Select
'SELECT COLUMNS TO BE COPIED
Range("A:A,D:D,E:E,R:R,S:S").Select
Range("S1").Activate
Selection.Copy
Windows("AveragePrices.xlsm").Activate
Range("A1").Select
ActiveSheet.Paste
Windows("DAILYOUTPUT.CSV").Activate
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
'COUNT ROWS
Cells.Select
ActiveSheet.UsedRange.Select
LASTROW = Selection.Rows.Count
‘SORT ROWS
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range(Cells(2, 2), Cells(LASTROW, 2)), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range(Cells(1, 1), Cells(LASTROW, 5))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
For r = 2 To LASTROW
Next r
' Columns("A:F").Select
Columns("A:F").EntireColumn.AutoFit
Columns("E:F").Select
Selection.Style = "Currency"
SWITCH ON SCREEN UPDATING
Application.ScreenUpdating = True
Cells(1, 1).Select
EXCEL
Diary Dates |
Page Numbering |
Desktop Publishing |
Useful stuff |
Site Map |
Access |
Excel |
inDesign |
Ubuntu |
Word |
ASCII Codes |
Search Results |
Diary Dates |
Page Numbering |
Desktop Publishing |
Useful stuff |
apiary |
Berry Head Mast |
Building |
Golden Hind |
The Barn |
Wall |
Volunteer |
Phil |
Vigilance Mast |
Asian Hornet Forum |