mhieuit
Thành viên hoạt động



- Tham gia
- 3/9/13
- Bài viết
- 163
- Được thích
- 19
- Nghề nghiệp
- Data controller
Dear GPE,
em có đoạn code như bên dưới, nhưng mọi khi chạy code này thì chạy rất lâu (nếu có trên 50 sheets), anh/chị có cách nào làm cho đoạn code này chạy nhanh không ạ, vì file của em có khi có hơn 100 sheets lận
Thanks all.
em có đoạn code như bên dưới, nhưng mọi khi chạy code này thì chạy rất lâu (nếu có trên 50 sheets), anh/chị có cách nào làm cho đoạn code này chạy nhanh không ạ, vì file của em có khi có hơn 100 sheets lận
Thanks all.
PHP:
[CODE]Private Sub SetDN()Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim i As Integer
Dim iRet As Integer
Dim strPrompt As String
Dim strTitle As String
For i = 1 To Sheets.Count
Sheets(i).Columns("C").EntireColumn.Hidden = True
Sheets(i).Columns("D").EntireColumn.Hidden = True
Sheets(i).Columns("Q").EntireColumn.Hidden = True
Sheets(i).Columns("R").EntireColumn.Hidden = True
Sheets(i).Columns("T").ColumnWidth = 10
Sheets(i).Columns("W").ColumnWidth = 10
Sheets(i).Range("A16:A100").RowHeight = 25
With Sheets(i).PageSetup
.Zoom = 95
.RightHeader = "Page &P of &N"
.PrintTitleRows = "$1:$15"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.1)
.TopMargin = Application.InchesToPoints(0.1)
.BottomMargin = Application.InchesToPoints(0.1)
End With
Next i
' Promt
strPrompt = "Done Set Page, OK?"
' Dialog's Title
strTitle = "Information"
'Display MessageBox
iRet = MsgBox(strPrompt, vbOKOnly, strTitle)
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub[/CODE]

