画面更新
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ファイルを開く
[ファイル]-[開く]-[参照]
- 開く
- 読み取り専用
- コピー
- 保護ビュー
- 開いて修復...
Public Function mthSelectFileDialog( _
Optional sPath As String _
) As String
Dim sRes As String
If sPath = "" Then
sPath = ThisWorkbook.Path
End If
If Not mFSO.FileExists(sPath) Then sPath = ThisWorkbook.Path
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.InitialFileName = sPath
.ButtonName = "開く"
.Filters.Clear
.Filters.Add "Excelファイル", "*.xls"
End With
Dim lRet As Long
lRet = fd.Show
If lRet = 0 Then
Set fd = Nothing
Exit Function
End If
mthSelectFileDialog = fd.SelectedItems.Item(1)
End Function
R1C1参照形式
[ファイル]-[オプション]-[数式]-[数式の処理]
[R1C1参照形式]
Application.ReferenceStyle = IIf(Application.ReferenceStyle = xlR1C1, xlA1, xlR1C1)
計算方法の設定
[ファイル]-[オプション]-[数式]-[計算方法の設定]
Public Sub mthCalculation()
Dim app As Application
Set app = Application
With app
.Calculation = xlCalculationManual
.Calculate
.Calculation = xlCalculationAutomatic
End With
Dim wb As Workbook
Set wb = app.Workbooks(ThisWorkbook.Name)
With wb
End With
Dim ws As Worksheet
Set ws = wb.Worksheets(wb.Sheets(1).Name)
With ws
.Calculate
End With
Dim rng As Range
Set rng = ws.Range(Cells(2, 1), Cells(10, 10))
With rng
.Calculate
End With
Set ws = Nothing
Set wb = Nothing
Set app = Nothing
End Sub