我有下面的代碼,但它只在列A中顯示。我想讓宏先找到列標題,然後按單元格值進行搜索。基於列名和單元格值的Excel宏到粗體
例子。列名稱是「天」(在Excel表中的某處),單元格值是「星期六」,「星期天」。所以,如果星期六或星期天在那一行,但不是那個列,它就不會大膽。這可能嗎?在此先感謝您的幫助。
Sub Bold_Row_Based_on_Call_Value_and_Column_Name()
Dim cRow As Long
Dim rRow As Range
Dim LastRow As Long
'Gets the last row with data in it
LastRow = [A65000].End(xlUp).Row
'the look to move down the cells
For cRow = 1 To LastRow
'if statment so catch the values that are wanted
If Cells(cRow, 1) = "Saturday" Or Cells(cRow, 1) = "Sunday" Then
'the changes made to the rows
Rows(cRow).Font.Bold = True
End If
Next cRow
End Sub
比你先和另添加表的畫面/片段(一個運行宏後)?你的描述和例子很混亂! –
如果列A中的單元格有「星期日」或「星期六」,您希望列A中的單元格變粗體?現在不是這樣嗎? – BruceWayne