Sub LoopSheets()
Dim ws As Worksheet
For Each ws In Sheets
ReplaceText "111", "你好", ws
Next
End Sub
Function ReplaceText(src As String, Rpl As String, sht As Worksheet)
sht.Cells.Replace What:=src, Replacement:=Rpl, LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Function作者: 准提部林 時間: 2016-4-19 20:37
Sub LoopSheets()
Dim ws As Worksheet
For Each ws In Sheets
ws.[J:J].Replace "111", "你好", Lookat:=xlWhole
Next
End Sub作者: EddieLiang 時間: 2016-4-20 14:46
Sub LoopSheets()
Dim Sht As Worksheet, xR As Range
For Each Sht In Sheets
For Each xR In Sht.[J4:J20]
If xR & "" = "111" And xR(1, 0) <> "" Then xR = "你好"
Next
Next
End Sub
xR(1, 0) 往左一格,即是i欄!
或:
Sub LoopSheets()
Dim Sht As Worksheet, xR As Range
For Each Sht In Sheets
For Each xR In Range(Sht.[J4], Sht.[J65536].End(xlUp)) 抓資料範圍 If xR & "" = "111" And xR(1, 0) <> "" Then xR = "你好"
Next
Next
End Sub
Sub format()
Dim Sht As Worksheet, xR As Range
For Each Sht In Sheets [[準大這下面兩列我沒辦法理解]]
For Each xR In Range(Sht.[J4], Sht.[J65536].End(xlUp)) '抓資料範圍從J4開始 [[懇請指導]]
If xR & "" <> "完成(finish)" And xR(1, 0) <> "" Then xR = "Wait for test" '判斷j欄非完成字串,i欄有資料帶入Wait for test字串 [[這code經過您指導後改為非完成字串判斷改為waitfortest,非常受用非常感謝您]]
Next
Next
Dim Sht As Worksheet, xR As Range 'Worksheet.("sheet1")
For Each Sht In Sheets 'In Worksheet("sheet1")
For Each xR In Range(Sht.[J4], Sht.[J65536].End(xlUp)) '抓資料範圍從J4開始
If xR & "" <> "完成(finish)" And xR(1, 0) <> "" Then xR = "Wait for test" '判斷i欄有無資料帶入字串
Next
Next
Sub format()
Dim xR As Range
With Sheets("Sheet1")
For Each xR In Range(.[J4], .[J65536].End(xlUp))
If xR & "" <> "完成(finish)" And xR(1, 0) <> "" Then xR = "Wait for test" '判斷i欄有無資料帶入字串
Next
End With
End Sub作者: EddieLiang 時間: 2016-4-26 11:04
Sub 繪製外框線()
MsgBox “在所選取的儲存格範圍四周繪製外框線”
With Selection
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
End With
End Sub