所以我递归地将一些文本写到表格上。在另一张工作表中,我将所有这些文本值放在另一张工作表的列中,其中右列包含我拥有的文本值的相应重命名和格式。这是一个例子: https://ethercalc.org/46ky7t3kbik1
如何引用此“格式设置”工作表,以获取可以映射到的每个单元格右侧的单元格的值和格式?
答案 0 :(得分:1)
因此不确定递归部分,但这是引用sheets/cells
并搜索粗体和彩色的单词的方法。
Function returnFontColor(targetString As String) As Integer
Dim formatSheet As Worksheet
Dim lastRow As Long
Dim row As Long
Dim counter As Integer
returnFontColor = 0
Set formatSheet = ThisWorkbook.Worksheets("insert format sheet name")
With formatSheet
lastRow = .Cells(.Rows.Count, 2).End(xlUp).Row
For row = 2 To lastRow
If Lcase(CStr(.Range("B" & row).Value)) = Lcase(CStr(targetString)) Then
For counter = 1 To Len(.Range("C" & row).Value)
If .Range("C" & row).Characters(Start:=counter, Length:=1).Font.ColorIndex <> 0 Then
returnFontColor = .Range("C" & row).Characters(Start:=counter, Length:=1).Font.ColorIndex
GoTo Exiter
End If
Next
End If
Next
End With
Exiter:
End Function