DUFE journals in PDF format

http://kaiwu.city/index.php/downloads?task=download.send&id=6&catid=2&m=0

 

how to show the developer tab(Excel VBA)

https://docs.microsoft.com/en-us/visualstudio/vsto/how-to-show-the-developer-tab-on-the-ribbon?view=vs-2019

Getting started with VBA in Office

https://docs.microsoft.com/en-us/office/vba/library-reference/concepts/getting-started-with-vba-in-office

 


 Excel VBA, replace,autofit,for loop,cstr,delete row,save,last row

 

VBA DUFE journals

 

Public Sub dufe_journals() 
'merge 53 sheets
For i = 1 To 53
    sheet_start_row = 1 + 20 * (i - 1)
    sheet_name = "Sheet" & CStr(i)
 
    Sheets(sheet_name).Select
    Range("A1:E20").Select
    Selection.Copy
 
    Sheets("journals").Select
    Range("A" & CStr(sheet_start_row)).Select
    ActiveSheet.Paste
Next i
 ' get the row number of last row in the dataset
last_row = Cells(Rows.Count, 1).End(xlUp).Row
 ' replace alt+enter with space

For m = 1 To 5
    For n = 1 To last_row
        'Chr(10) is alt + enter
        'Chr(32) is space
        'https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/character-set-0127
        Cells(n, m).Select
        ActiveCell.Replace Chr(10), Chr(32), xlPart, xlByColumns
    Next n
Next m
 'Auto Adjust the Column Width.

For m = 1 To 5
    Columns(m).AutoFit
Next m 
 
'Auto Adjust the Row Height.
For n = 1 To last_row
    Rows(n).AutoFit
Next n 
'delete row 1
Rows("1:1").Select
Selection.Delete Shift:=xlUp
 'save the workbook
ActiveWorkbook.Save End Sub