CryoTemp 目錄 溫度集錄器 - umarket.com.t配備3個led 燈,具有特殊功能如下: 當【啟動記錄】時,綠色led 每15 秒閃爍。 當溫度【曾經】超過警告界限,黃色led
巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : –...
-
Upload
gervais-dixon -
Category
Documents
-
view
227 -
download
7
Transcript of 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : –...
![Page 1: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/1.jpg)
巨集錄製VB for Application (VBA)
![Page 2: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/2.jpg)
巨集錄製• 命令
– 檢視 / 巨集
• 練習 :– 錄製巨集名為 : test– 在 c4 輸入 巨集 並設為 綠色– 停止巨集錄製,並檢視巨集
![Page 3: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/3.jpg)
VBA
• 命令– 檢視 / 巨集 之檢視巨集 下– 輸入 find_noun 後建立
• 巨集程式輸入• Sub find_noun()
• End Sub
![Page 4: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/4.jpg)
VBA (simple)• Sub find_noun()
• Dim range1 As Range• Dim cell1 As Range• Dim strign1 As String• string1 = InputBox(" 請輸入範圍 ")• Set range1 = Range(string1)
• For Each cell1 In range1• If cell1.Value = " 學期成績 " Then MsgBox Title:=" 輸出 ", prompt
cell1.Address• Next cell1
• End Sub
![Page 5: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/5.jpg)
• 找到 學期成績位置– For Each cell1 In range1– If cell1.Value = " 學期成績 " Then cell1.Select: Exit For
– Next cell1
• 找到 成績 小於 60 分– Set cell2 = ActiveCell.Offset(rowoffset:=i, columnoffset:=0)
– If cell2.Value < 60 Then
• 找出那姓名– MsgBox cell2.Offset(rowoffset:=0, columnoffset:=-6).Value
![Page 6: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/6.jpg)
• 改屬性• With cell2.Offset(rowoffset:=0, columnoffset:=-6).Font• .Underline = xlUnderlineStyleNone• .ColorIndex = 3• End With• With cell2.Offset(rowoffset:=0, columnoffset:=-6).Interior• .ColorIndex = 43• .Pattern = xlSolid• .PatternColorIndex = xlAutomatic• End With
![Page 7: 巨集錄製 VB for Application (VBA). 巨集錄製 命令 – 檢視 / 巨集 練習 : – 錄製巨集名為 : test – 在 c4 輸入 巨集 並設為 綠色 – 停止巨集錄製,並檢視巨集.](https://reader030.fdocuments.net/reader030/viewer/2022020718/56649ec75503460f94bd3dcd/html5/thumbnails/7.jpg)
• Sub find_noun()• Dim range1 As Range• Dim cell1 As Range• Dim cell2 As Range• Dim strign1 As String• string1 = InputBox(" 請輸入範圍 ")• Set range1 = Range(string1)• For Each cell1 In range1• If cell1.Value = " 學期成績 " Then cell1.Select: Exit For • Next cell1
• For i = 1 To 20 Step 1• Set cell2 = ActiveCell.Offset(rowoffset:=i, columnoffset:=0)• If cell2.Value < 60 Then• MsgBox cell2.Offset(rowoffset:=0, columnoffset:=-6).Value• With cell2.Offset(rowoffset:=0, columnoffset:=-6).Font• .Underline = xlUnderlineStyleNone• .ColorIndex = 3• End With• With cell2.Offset(rowoffset:=0, columnoffset:=-6).Interior• .ColorIndex = 43• .Pattern = xlSolid• .PatternColorIndex = xlAutomatic• End With• End If • Next i• End Sub