Go Top

2019年1月14日 星期一

[test] 顯示 GitHub Gist 程式碼,並且套用(比較)一致的顯示風格

GitHub 是現在很熱門的程式碼管理工具,它甚至也提供了純粹用來分享程式碼片段的功能: Gist。甚至不需要註冊,就可以使用,也支援版本管理。當然,它也提供了在網頁上顯示程式碼的功能,只要複製要 分享的程式碼片段的頁面 左邊的 Embed this gist 內容,貼到 html 上即可。 貼上的 html 程式碼,長得像這個樣子: <script src="https://gist.github.com/tsaiid/6b4b20242367425726fb.js"></script>
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Function ExistInSelection(criteria) As Boolean
For Each a In Selection.Areas
If WorksheetFunction.CountIf(a, criteria) Then
ExistInSelection = True
Exit Function
End If
Next
ExistInSelection = False
End Function
Sub RandRanges()
Dim CellsCount As Integer
CellsCount = Selection.Cells.Count
If CellsCount > 1 Then
Dim i As Integer
For i = 1 To 50
Selection.Clear
For Each c In Selection.Cells
Dim UniqueNo As Integer
Do
UniqueNo = WorksheetFunction.RandBetween(1, CellsCount)
Loop While ExistInSelection(UniqueNo)
c.Value = UniqueNo
Next
Sleep (20)
Next i
End If
End Sub
view raw RandRanges hosted with ❤ by GitHub

沒有留言:

張貼留言

Copyright © 2025 BCL BLOG | Powered by Blogger