[[20211124221126]]@w”¼Šp‚Æ‘SŠp¬Ý‚Ì•¶Žš—ñ•ªŠ„‚ɂ‚¢‚āBxiƒCƒ}j@>>BOT

[ ‰‚ß‚Ä‚Ì•û‚Ö | ˆê——(ÅVXV‡) |

| ‘S•¶ŒŸõ | ‰ß‹ŽƒƒO ]

@

w”¼Šp‚Æ‘SŠp¬Ý‚Ì•¶Žš—ñ•ªŠ„‚ɂ‚¢‚āBxiƒCƒ}j

"‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V"

ã‹L‚̂悤‚È”¼Šp‚Æ‘SŠp‚Ì•¶Žš—ñ‚ª‚ ‚è
40byte‚²‚Æ‚É‹æØ‚肽‚¢ê‡‚É
•¶Žš—ñ‚Ì’l‚ª40byte‚ÅŠ„‚èØ‚ê‚È‚¢ê‡
"‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa"‚Ü‚Å
•¶Žš‰»‚¯‚ð‚µ‚È‚¢‚悤‚ɍ¶‚©‚當Žš—ñ‚ðŽæ‚èo‚µ‚Ä‚¢‚é‚Ì‚Å‚·‚ª
40byteˆÈ~‚ðŽæ‚èo‚·•û–@‚ŃAƒhƒoƒCƒX‚¢‚½‚¾‚¯‚È‚¢‚Å‚µ‚傤‚©B
‚æ‚낵‚­‚¨Šè‚¢‚¢‚½‚µ‚Ü‚·B

"‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V"
«
‰º‹L‚̂悤‚É•ªŠ„

"‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa"(40byteˆÈ“à)
"‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb"(40byteˆÈ“à)

Sub TEST()

    ZŠŠ¿Žš = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V"

    Debug.Print ConvLeftBStr(ZŠŠ¿Žš, 40)

End Sub

Function ConvLeftBStr(varData As Variant, intLenB As Integer) As String

  Dim strBin As String
  Dim strRet As String

  strBin = StrConv((varData), vbFromUnicode)

  If LenB(strBin) <= intLenB Then

    strRet = (varData)
  Else

    If LenB(StrConv(LeftB(strBin, intLenB), vbUnicode)) = _
        LenB(StrConv(LeftB(strBin, intLenB + 1), vbUnicode)) Then

      strRet = StrConv(LeftB(strBin, intLenB - 1), vbUnicode)
    Else
      strRet = StrConv(LeftB(strBin, intLenB), vbUnicode)
    End If
  End If

  ConvLeftBStr = strRet

End Function

ƒ Žg—p ExcelFExcel2019AŽg—p OSFWindows10 „


 ‚±‚ñ‚ÈŠ´‚¶‚Å‚Í‚Ç‚¤‚Å‚µ‚傤B

 Sub test()
     Const n As Long = 40
     Dim s As String
     Dim ss As String
     ReDim ary(0 To 0) As String

     s = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V"
     Columns("A").NumberFormat = "@"
     Do
         ss = LeftB(s, n)
         ary(UBound(ary)) = ss
         s = Replace(s, ss, "", Count:=1)
         If s = "" Then Exit Do
         ReDim Preserve ary(UBound(ary) + 1)
         If LenB(StrConv(s, vbFromUnicode)) <= n Then
             ary(UBound(ary)) = s
             Exit Do
         End If
     Loop

     [A1].Resize(UBound(ary) + 1, 1) = Application.Transpose(ary)
 End Sub
 # C³‚µ‚Ü‚µ‚½B
 # Ž¿–âŽÒ‚³‚ñ‚̃R[ƒh‚ÅŠ®¬‚µ‚Ä‚¢‚½‚Ì‚Å‚·‚ˁB‚Ç‚¤‚àŽ¸—çB

iƒÁj 2021/11/25(–Ø) 01:16


 ’ñŽ¦‚ÌConvLeftBStr‚ðŽg‚¤‚È‚çA

 Sub TEST()
    Dim ZŠŠ¿Žš As String, res As String
    ZŠŠ¿Žš = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚Vaaa"

    Do
        res = ConvLeftBStr(ZŠŠ¿Žš, 40)
        Debug.Print res
        If res = ZŠŠ¿Žš Then Exit Do
        ZŠŠ¿Žš = Mid(ZŠŠ¿Žš, Len(res) + 1)
    Loop
 End Sub
ihatenaj 2021/11/25(–Ø) 04:58

ƒÁ—l
hatena—l
ƒTƒ“ƒvƒ‹ƒR[ƒh‚²’ñŽ¦‚ ‚肪‚Æ‚¤‚²‚´‚¢‚Ü‚·B
ŽQl‚É‚³‚¹‚Ä‚¢‚½‚¾‚«‚Ü‚·B
iƒCƒ}j 2021/11/25(–Ø) 10:59

Œ»Ý‰º‹L‚̃R[ƒh‚Å
 ZŠŠ¿Žš = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V12345"‚¾‚Á‚½ê‡
‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa,
‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V12345‚Æ‚È‚é‚Ì‚Å‚·‚ª
‰º‹L‚ÌŒ‹‰Ê‚̂悤‚É

‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa,
‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb,
‚V12345

40byte‚²‚Æ‚É”z—ñ‚ð‹æØ‚肽‚¢‚Ì‚Å‚·‚ªƒAƒhƒoƒCƒX‚¢‚½‚¾‚¯‚é‚Ə•‚©‚è‚Ü‚·B
•â‘«‚Å‚·‚ª120byteˆÈã‚ ‚éê‡‚Í
”z—ñ‚Í‚S‚‚ɂȂÁ‚Ä‚¢‚­‚Ì‚ð‘z’肵‚Ä‚¨‚è‚Ü‚·B

¡‰ñ‰º‹L‚Å‚²’ñŽ¦‚³‚¹‚Ä‚¢‚½‚¾‚¢‚½ƒR[ƒh‚Å
—¬—p‚·‚éê‡‚Ì
ƒAƒhƒoƒCƒX‚𒸂¯‚½‚ç‘å•Ï•‚©‚è‚Ü‚·B

 Sub test()

Dim address1 As String, address2 As String, address3 As String
Dim work As String
Dim ii As Integer

ZŠŠ¿Žš = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V12345"

For ii = 1 To Len(ZŠŠ¿Žš)

    work = Left(ZŠŠ¿Žš, ii)
    work = StrConv(work, vbFromUnicode)
    If (LenB(work) > 40) Then
        Exit For
    End If
Next ii

address1 = Left(ZŠŠ¿Žš, ii - 1) 'ZŠ‚P
address2 = Mid(ZŠŠ¿Žš, ii) 'ZŠ‚Q

       Debug.Print address1 & "," & address2

End Sub
iƒCƒ}j 2021/11/25(–Ø) 11:16


 40ƒoƒCƒg‚²‚ƂɃJƒ“ƒ}‚ð‘}“ü‚µ‚½‚¢‚Æ‚¢‚¤‚±‚Æ‚È‚çA‰º‹L‚ŁB

 Sub test()
    Dim address As String
    Dim ZŠŠ¿Žš As String
    Dim work As String

    ZŠŠ¿Žš = "‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb‚V12345"
    Do
        work = ConvLeftBStr(ZŠŠ¿Žš, 40)
        address = address & "," & work
        If work = ZŠŠ¿Žš Then Exit Do
        ZŠŠ¿Žš = Mid(ZŠŠ¿Žš, Len(work) + 1)
    Loop
    address = Mid(address, 2)

    Debug.Print address
 End Sub

 ConvLeftBStr‚ÍŽ¿–â‚É‚ ‚éŠÖ”‚»‚̂܂܂ŁB

 ”z—ñ‚É‚µ‚½‚¢‚È‚çAÅŒã‚É Split(address,",") ‚Å”z—ñ‚É•ÏŠ·‚Å‚«‚Ü‚·B
ihatenaj 2021/11/25(–Ø) 14:32

hatena—l@
‚ ‚肪‚Æ‚¤‚²‚´‚¢‚Ü‚·B
‚±‚Ì‚Ü‚Ü‚Å‚ÍDebug.Print‚ª•\Ž¦‚³‚ê‚Ü‚¹‚ñ‚ª
‚±‚¿‚ç‚Í”¼Šp‘SŠp¬‡‚Å
40ƒoƒCƒg‚ÅŠ„‚èØ‚ê‚È‚¢ê‡A•¶Žš‰»‚¯‚µ‚È‚¢ƒTƒ“ƒvƒ‹‚Å‚µ‚傤‚©B
‚»‚ê‚Æ‚à‚ ‚­‚Ü‚Å
40ƒoƒCƒg‚²‚ƂɃJƒ“ƒ}‚ð‘}“ü‚·‚éƒCƒ[ƒW‚Å‚µ‚傤‚©B
‚¨Žè”‚ð‚¨‚©‚¯‚µ‚Ü‚·B
iƒCƒ}j 2021/11/25(–Ø) 14:51

ƒÁ—lB
ƒTƒ“ƒvƒ‹•‚©‚è‚Ü‚·B
‚±‚¿‚ç‚̃R[ƒh‚̓Zƒ‹‘€ì‚Å‚·‚ª
debug.print‚Å•\Ž¦‚Å‚«‚é‚悤‚É
‚·‚é‚ƃR[ƒh“I‚ɂǂ̂悤‚É‚È‚è‚Ü‚·‚©B
‚¨Žè”‚ð‚¨‚©‚¯‚µ‚Ü‚·B
iƒCƒ}j 2021/11/25(–Ø) 14:54

 ‚±‚¿‚ç‚ł́AƒCƒ~ƒfƒBƒGƒCƒgƒEƒBƒ“ƒhƒE‚ɁA

 ‚P‚Q‚R‚S‚T‚U‚V‚W‚X‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚Xa,‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚V‚Vb,‚V12345

 ‚ƃJƒ“ƒ}‹æØ‚è‚Å•\Ž¦‚³‚ê‚Ä‚Ü‚·‚¯‚ǁB

 Ž¿–â‚É‚ ‚鉺‹L‚̃R[ƒh‚͍폜‚µ‚Ä‚¢‚È‚¢‚Å‚·‚æ‚ˁB

 Function ConvLeftBStr(varData As Variant, intLenB As Integer) As String
  Dim strBin As String
  Dim strRet As String
  strBin = StrConv((varData), vbFromUnicode)
  If LenB(strBin) <= intLenB Then
    strRet = (varData)
  Else
    If LenB(StrConv(LeftB(strBin, intLenB), vbUnicode)) = _
        LenB(StrConv(LeftB(strBin, intLenB + 1), vbUnicode)) Then
      strRet = StrConv(LeftB(strBin, intLenB - 1), vbUnicode)
    Else
      strRet = StrConv(LeftB(strBin, intLenB), vbUnicode)
    End If
  End If
  ConvLeftBStr = strRet
 End Function 

ihatenaj 2021/11/25(–Ø) 15:00


hatena—l
Ž¸—炵‚Ü‚µ‚½B
Debug.PrintŠm”F‚Å‚«‚Ü‚µ‚½B
ŽÀÛ‚̃eƒXƒgƒf[ƒ^‚©‚ç
‚¢‚ë‚¢‚ë‚ȃpƒ^[ƒ“‚̃eƒXƒgƒf[ƒ^‚ÅŒŸØ‚µ‚½‚Æ‚±‚ë
¡‚Ì‚Æ‚±‚ë–â‘è‚È‚­
³í‚ÈŽÀsŒ‹‰Ê‚ª“¾‚ç‚ê‚Ä‚¨‚菕‚©‚è‚Ü‚µ‚½B
‚ ‚肪‚Æ‚¤‚²‚´‚¢‚Ü‚µ‚½B

iƒCƒ}j 2021/11/25(–Ø) 17:06


ƒRƒƒ“ƒg•ÔMF

[ ˆê——(ÅVXV‡) ]


YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki. Modified by kazu.