ããããããç»åãã»ã«ã®èæ¯è²ã§æç»ãã
ä»åã¯ãã¨ã¯ã»ã«ã®ã·ã¼ãä¸ã«ã»ã«ã®èæ¯è²ã使ã£ã¦ããããããç»åãæç»ãã¦ã¿ããã¨æãã¾ããæä½æ¥ã§1ã»ã«ãã¤ã¡ã¾ã¡ã¾ã¨ï½¥ï½¥ï½¥ï½¥ï½¥ï½¥ã§ã¯ãªãVBAã§ãã§ããä½æ ãããããããã¨æã£ãã®ãã¯èªåã§ãè¬ã§ãã
ã§ã¯ããã£ã¦ã¿ã¾ãããï¼
Â
ãããããããã¡ã¤ã«ã®æ§é ãç解ãã
ããã°ã©ã ã®åã«ãã¾ãããããããããã¡ã¤ã«ã®æ§é ãç解ããå¿ è¦ãããã¾ããä¸ã®ç»åã¯ããããããããã¡ã¤ã«ããã¤ããªã¨ãã£ã¿ã§éãããã®ã§ãããã¡ã¤ã«ã®0ï½53çªç®ããããã54çªç®ï½æ«å°¾ãç»åãã¼ã¿ã«ãªã£ã¦ãã¾ãã
ãããã«ã¯ç»åã«é¢ããæ§ã
ãªæ
å ±ãå
¥ã£ã¦ãã¾ããä»åã¯ãç»åã®æ¨ªå¹
ï¼ãã¯ã»ã«ï¼ã¨ç¸¦å¹
ï¼ãã¯ã»ã«ï¼ã®ã¿ããã°ã©ã å
ã§ä½¿ç¨ãã¾ãã
ç»åãã¼ã¿ã«ã¯ãã¯ã»ã«ãã¨ã®è²ãæ°å¤ã§è¨é²ããã¦ãã¾ãããã ãè²ãããæ°ã«ãã£ã¦ã1ãã¯ã»ã«ã表ç¾ãããã¤ãæ°ãç°ãªãã¾ãã24ãããã«ã©ã¼ã§ããã°ã3ãã¤ãï¼ï¼²ã»Gã»ï¼¢ï¼ã§1ãã¯ã»ã«ã表ç¾ãã¦ãã¾ããè²ãããæ°ã«é¢ä¿ãªããç»åãã¼ã¿ã¯å·¦ä¸ããå³ä¸ã®é ã«è¨é²ããã¦ãã¾ãã
ã¾ãããã¼ã¿ã®ä¸¦ã³é ã¯ãªãã«ã¨ã³ãã£ã¢ã³ã§ããããã°ã©ã ã§ãã¼ã¿ãæ±ãéã«ã¯ããã®ç¹ã«æ³¨æãã¾ãã
Â
ãããããããã¡ã¤ã«ã«ã¤ãã¦åèã«ãããµã¤ãÂ
Â
ããã°ã©ãã³ã°ãã¦ã¿ã¾ã
ä»åã¯ãç»åãã¼ã¿ã®è¡¨ç¾æ¹æ³ãä¸çªåãããããã24ãããã«ã©ã¼éå®ã§ããã°ã©ãã³ã°ãã¦ã¿ã¾ããã
Sub ããããããç»åãã»ã«ã§æç»ãã() '24ãããããããããã®ã¿å¦çå¯è½ Dim ãã¡ã¤ã«å As Variant Dim é å() As Byte Dim i As Long Dim tmp As String Dim 横 As Long Dim 縦 As Long Dim è©°ç© As Integer Dim è¡ As Long Dim å As Long Dim è² As String ãã¡ã¤ã«å = Application.GetOpenFilename(Title:="ããããããç»åãé¸æ") If TypeName(ãã¡ã¤ã«å) = "Boolean" Then Exit Sub Open ãã¡ã¤ã«å For Binary As #1 ReDim é å(LOF(1)) Get #1, , é å Close #1 tmp = "" For i = 18 To 21 'ç»åã®æ¨ªå¹ ï¼ãã¯ã»ã«ï¼ãåå¾ tmp = WorksheetFunction.Dec2Hex(é å(i), 2) & tmp Next i 横 = WorksheetFunction.Hex2Dec(tmp) tmp = "" For i = 22 To 25 'ç»åã®ç¸¦å¹ ï¼ãã¯ã»ã«ï¼ãåå¾ tmp = WorksheetFunction.Dec2Hex(é å(i), 2) & tmp Next i 縦 = WorksheetFunction.Hex2Dec(tmp) If (横 * 3 Mod 4) <> 0 Then è©°ç© = 4 - (横 * 3 Mod 4) 'æ¨ªå¹ ã4ãã¤ãã§å²ãåããªãå ´åã®è©°ç©ã®æ°ãç®åº i = 54 'ç»åãã¼ã¿éå§ä½ç½® For è¡ = 縦 To 1 Step -1 For å = 1 To 横 è² = WorksheetFunction.Dec2Hex(é å(i), 2) _ & WorksheetFunction.Dec2Hex(é å(i + 1), 2) _ & WorksheetFunction.Dec2Hex(é å(i + 2), 2) Cells(è¡, å).Interior.Color = WorksheetFunction.Hex2Dec(è²) i = i + 3 DoEvents Next å i = i + è©°ç© Next è¡ End Sub
 ããã°ã©ã ã®å¤§ã¾ããªèª¬æ
- æç»ãããããããããç»åã®ãã«ãã¹ãåå¾ãã¾ããä»åã¯ããã¤ã¢ãã°ããã¯ã¹ã§ãã¡ã¤ã«é¸æã§ããå½¢ã«ãã¾ããã
- ãããããããã¡ã¤ã«ããã¤ããªå½¢å¼ã§éãããã¤ãåã®é åã«ã¾ãã£ã¨æ ¼ç´ãã¾ãããããããã¨ã§ããããããããã¡ã¤ã«ã®å é ããä½ãã¤ãç®ã§ãããããé åã®æ·»åã§ãºããªæå®ãããã¨ãã§ãã¾ãã
- ç»åã®æ¨ªå¹ ï¼ãã¯ã»ã«ï¼ã¨ç¸¦å¹ ï¼ãã¯ã»ã«ï¼ãåå¾ãã¾ãããã¼ã¿ã®ä¸¦ã³ãããªãã«ã¨ã³ãã£ã¢ã³ã§ãããã¨ã«æ³¨æãã¾ãã
- ç»åã®æ¨ªå¹ ã4ãã¤ãã§å²ãåããªãå ´åã«ã0åãããã¦ãããã¤ãæ°ãç®åºãã¾ããâ»è©³ç´°ã¯å¾è¿°
- ç»åãã¼ã¿ã®éå§ä½ç½®ããã3ãã¤ããã¤è²ï¼ã表ç¾ããæ°å¤ï¼ãåå¾ããã»ã«ã®èæ¯è²ã«æå®ãã¦ããã¾ãããããç¸¦å¹ ã¨æ¨ªå¹ ã®åã ããè¡ã¨åã«ã«ã¼ãããã¾ããç»åãã¼ã¿ã¯å·¦ä¸ããå³ä¸ã®é ã«å ¥ã£ã¦ããã®ã§ãä¸ããä¸ã«åãã£ã¦æç»ãããããã«ãã¾ããä½è«ã§ãããã»ã«ã®èæ¯è²ã¯ãªãã«ã¨ã³ãã£ã¢ã³ã®ã¾ã¾ï¼BGRã®ä¸¦ã³ï¼ã§æå®ãããã¨ãã§ãã¾ããï¼RGBé¢æ°ã使ç¨ãããªããå¼æ°ã¯RGBã®é ãªã®ã§æ··ä¹±ããªãããã«ï½¥ï½¥ï½¥ï½¥ï½¥ï½¥ï¼
Â
ä»åããããããã¯æ¨ªå¹ ã¨ç¸¦å¹ ã®æ å ±ããå¾ã¦ãã¾ããããä»ã®æ å ±ãå©ç¨ãããã¨ã§ãç´°ããå¦çãåå²ããããã¨ãã§ãã¾ããä¾ãã°ãããããããç»å以å¤ã§ããã°ã¨ã©ã¼è¡¨ç¤ºãã¦çµäºããã24ãããã«ã©ã¼ä»¥å¤ã®ã«ã©ã¼ã«å¯¾å¿ããããªã©ã
Â
æ±åããåï¼ããªã¼ç´ æï¼ãæç»ãã¦ã¿ããï¼
ãããå ç»å
Â
ãã¯ãå®è¡å¾ã«è¡¨ç¤ºããããã¤ã¢ãã°ããã¯ã¹ã§ç»åãé¸æã§ããã®ã§ãç»åã¯ã©ãã«ç½®ãã¦ãã£ã¦ã大ä¸å¤«ã§ãã
ã§ã¯ããã£ããæç»ããã¦ã¿ã¾ãï¼
ä¸æããã£ãããã§ãï¼
ãªãããã¯ãã®å®è¡åã«æåã§ã»ã«ãæ£æ¹å½¢ï¼10ãã¯ã»ã«Ã10ãã¯ã»ã«ï¼ã«ãã表示åçã¯20%ã«ãã¦ããã¾ãã
ã¤ãã§ã«ãè²ãå¤ãããç»åãæç»ããã¨ãã»ã«ã®æ¸å¼ãå¤ããããããæ¸å¼ã追å ã§ãã¾ããããªãã¨ã©ã¼ãåºãã®ã§ãã注æã
Â
ç»åãã¼ã¿ã®æ¨ªå¹ ã4ãã¤ãã§å²ãåããªãå ´åã®è©±
ããããããç»åã¯æ¨ªæ¹åã®ãã¤ãæ°ã4ã®åæ°ã«ãªãããããã¼ã¿ãè¨é²ããã¦ãã¾ãã4ã®åæ°ã«æºããªãã¨ãã¯ãä¸è¶³åã0ã§åãããã¦ãã¾ãï¼ä»åã¯ã0åããããã¤ãããè©°ç©ãã¨è¡¨ç¾ãã¾ãï¼ã以ä¸ã¯ã24ãããã«ã©ã¼ã®ä¾ã§ãã
- æ¨ªå¹ ã1ãã¯ã»ã«ãªã3ãã¤ãã§ã4ã§å²ãåããªããããè©°ç©ã1ã¤å ¥ãã¦4ãã¤ãã«ã
- æ¨ªå¹ ã2ãã¯ã»ã«ãªã6ãã¤ãã§ã4ã§å²ãåããªããããè©°ç©ã2ã¤å ¥ãã¦8ãã¤ãã«ã
- æ¨ªå¹ ã3ãã¯ã»ã«ãªã9ãã¤ãã§ã4ã§å²ãåããªããããè©°ç©ã3ã¤å ¥ãã¦12ãã¤ãã«ã
- 横å¹
ã4ãã¯ã»ã«ãªã12ãã¤ãã§ã4ã§å²ãåãããããè©°ç©ã¯ç¡ãã
- æ¨ªå¹ ã5ãã¯ã»ã«ãªã15ãã¤ãã§4ã§å²ãåããªããããè©°ç©ã1ã¤å ¥ãã¦16ãã¤ãã«ã
Â
以éããã¯ã»ã«æ°ãå¢ãã¦ããã®ç¹°ãè¿ããÂ
縦æ¹åã«ããã®è©°ç©ã¯ããã¾ããã
Â
 ãããã«
èªåã§ã¯æãã¤ããªãé¨åããã£ãã®ã§ãããã¤ãã®ãµã¤ããåèã«ãã¾ãããã¾ããããã¯ç»åãæç»ãããæ§åãè¦ã¦å人çã«æ¥½ããã®ãç®çã§ãããä»äººæ§ã«è¦ãã³ãããã¨æ人æ±ããããå ´åãããã®ã§ã注æã