Dim startTime As Date
Dim usedTime As Long
startTime = Now()
Application.Calculation = xlCalculationManual 'これは必要に応じで
Application.ScreenUpdating = False
for each item in items
DoEvents
'do things
next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic 'これは必要に応じで
Application.Calculate
usedTime = DateDiff("s", startTime, Now())
MsgBox "完了しました。" & vbNewLine & vbNewLine & "経過時間:" & usedTime & "秒", vbInformation + vbOKOnly, "処理結果"
2013年5月30日木曜日
長時間処理時の大体のバターン、再利用のためメモした、高速化、画面更新停止、再計算停止
ラベル:
vba
2013年5月24日金曜日
svnサーバリポジトリURL変更時、コマンドラインでsvn switch relocateの例
ラベル:
linux
旧URL:http://svn.myproj.com
新URL:https://svn.myproj.com
まずはinfoを見てみる
svn info
そしてURLを変更
svn switch --relocate --username kagen88 http://svn.myproj.com https://svn.myproj.com
passwordをいれて完了
確認
svn info
svn up
2013年5月23日木曜日
web pageをゲットの2種方法 xmlhttp と querytables、querytablesの取得完了を待ってから処理する
ラベル:
vba
Public oXMLHTTP As New MSXML2.xmlhttp
Public Function ShowHTML(ByVal strURL, Optional ByVal strName = "") As String
On Error GoTo ErrorHandler
Dim strError As String
strError = ""
Dim strResponse As String
strResponse = ""
With oXMLHTTP
.Open "GET", strURL, False
.send ""
If .Status <> 200 Then
strError = .statusText
GoTo CleanUpAndExit
Else
If strName <> "" Then
Dim outtext As Long
outtext = FreeFile
Open ActiveWorkbook.Path & "\" & strName & ".txt" For Output As #outtext
Write #outtext, .responseText
Close #outtext
End If
strResponse = .responseText
End If
End With
CleanUpAndExit:
On Error Resume Next ' Avoid recursive call to error handler
' Clean up code goes here
Set oXMLHTTP = Nothing
' Report any error
If Len(strError) > 0 Then
MsgBox strError
Else
ShowHTML = strResponse
End If
Exit Function
ErrorHandler:
strError = Err.Description
Resume CleanUpAndExit
End Function
Sub test1()
repstr = ShowHTML("http://kagen88.blogspot.jp/")
ActiveSheet.Range("A1") = repstr
End Sub
Sub test2()
Set shFirstQtr = Workbooks(1).Worksheets(1)
Set qtQtrResults = shFirstQtr.QueryTables _
.Add(Connection:="URL;http://kagen88.blogspot.jp/", _
Destination:=shFirstQtr.Cells(1, 1))
With qtQtrResults
'.WebFormatting = xlAll
.WebFormatting = xlWebFormattingAll
.Refresh
End With
Dim timeToRun As Date
timeToRun = Now + TimeValue("0:00:05")
Application.OnTime timeToRun, "doSomething" '5秒を待って "doSomething"を実行
End Sub
Sub doSomething()
'Do Anything
End Sub
2013年5月14日火曜日
2013年5月10日金曜日
ExcelのDATE関数で「日」で「ゼロ」を入れると、前月の最終日が帰ってくる
Excelの数式「=DATE(年,月,日)」の「日」で「ゼロ」を入れると、前月の最終日が帰ってくる
値は 2013/1/31で帰ってくる
え?裏ワザ?
=DATE(2013,2,0)
値は 2013/1/31で帰ってくる
え?裏ワザ?
登録:
コメント (Atom)