Sub check()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("History")
Dim ws2 As Worksheet
Set ws2 = ThisWorkbook.Worksheets("Result")
Dim i As Long, j As Integer, k As Integer
i = 2
j = 0
k = 1
Do While ws.Cells(i, 3).Value <> ""
If ws.Cells(i, 3).Value = ws.Cells(i - 1, 3).Value Then
j = j + 1
Else
j = 0
End If
If j > 1 Then
ws2.Cells(k, 1).Value = ws.Cells(i, 3).Value
k = k + 1
End If
i = i + 1
Loop
Sheets("Result").Select
Columns("A:A").Select
' delete duplicate data
ActiveSheet.Range("$A$1:$A$5000").RemoveDuplicates Columns:=1, Header:=xlNo
MsgBox "End"
End Sub
Search This Blog
2020/08/20
2020/07/03
Create array in PowerShell
$hashArray = @{}
If($hashArray[$key] -eq $null) {
$hashArray.add("$key", @{
"key1" = "value"
"key2" = "value"
"key3" = "value"
}
)
}
$hashArray[$key]["key1"]
If($hashArray[$key] -eq $null) {
$hashArray.add("$key", @{
"key1" = "value"
"key2" = "value"
"key3" = "value"
}
)
}
$hashArray[$key]["key1"]
2020/05/27
Proxy and login sample | PowerShell
# proxy
# password must be secure string
$password = "yourPassword" | ConvertTo-SecureString -AsPlainText -Force
$proxyCred = New-Object System.Management.Automation.PsCredential("$uname@domain.tld", $password)
$proxyUrl = "your proxy url"
$proxy = New-Object System.Net.WebProxy $proxyUrl
$proxy.Credentials = $proxyCred
[System.Net.WebRequest]::DefaultWebProxy = $proxy
Write-Host("Proxy setting")
# login
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
$browser = New-Object System.Net.WebClient
$browser.Proxy.Credentials = $proxyCred
$loginUrl = "login url"
$loginPassword= "yourLoginPassword" |ConvertTo-SecureString -AsPlainText -Force
$BSTR = [Sysrem.Runtime.InteropServices.Marshal]::SecureStringToBSTR($loginPassword)
$unsecurePassword = [System.Rutime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$postParams = @{
username = "username"
password = $unsecurePassword
}
$Auth = Invoke-RestMethod -Uri $loginUrl -Method POST -Body $postParams
# $result = Invoke-RestMethod -Uri $loginUrl -Method GET -Headers $headers
2020/04/13
vba declare statement 64 bit warning
Declare Sub ... and warning declare statement 64bit warining, that code do not working.
According to Macrosoft doc:
Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA version 7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier, use the following construct:
#If VBA7 ThenDeclare PtrSafe Sub...#ElseDeclare Sub...#EndIf
2020/04/08
Make a float button in your web page
No need to write JavaScript, just CSS and working in most popular browsers.
z-index: 1000; display: block; position: fixed; is important.
<style>
.floatButton {
z-index: 1000;
display: block;
position: fixed;
bottom: 120px;
right: 120px;
}
</style>
<div class="floatButton"><button>float </button></div>
Subscribe to:
Posts
(
Atom
)