Compile error: Can't find project or library (OSX)
Compile error: Can't find project or library (OSX)
我 运行 在使我的宏与 OSX 兼容时遇到了一些问题,它在 windows.
上工作
我有以下问题:
Compile error: Can't find project or library error when running the macro on Office 2016 on a MAC
代码/函数用于将特定范围更改为大写/正确大小写。调试器突出显示 "UCase(Cell)"
和 "Cell"
Sub ChkSheet()
'=========================================================================
' Format the cell boarders when the info needs to be corrected or updated
'=========================================================================
Dim historyWks As Worksheet
Set historyWks = Worksheets("Namelist")
Dim lRow As Long
Dim emailRng As Range
Dim Cell As Range
With historyWks
' Flags cells where the Email fieldcontains invalid characters
lRow = Range("G" & Rows.Count).End(xlUp).Row
Set emailRng = Range("Q2:Q" & lRow)
For Each Cell In emailRng
If Cell.Value = "," _
Or Cell.Value = " " _
Or Cell.Value = "wd" _
Or Cell.Value = "" _
Or Cell.Find("@") Is Nothing Then
Cell.Interior.Color = vbRed
Else:
Cell.Interior.ColorIndex = 0
End If
Next
'Change the text case
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each Cell In Range("NListUpper")
Select Case True
Case Application.IsText(Cell) = True
Cell = UCase(Cell)
End Select
Next Cell
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
'Change the case to proper
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each Cell In Range("NListProp")
Select Case True
Case Application.IsText(Cell) = True
Cell = StrConv(Cell, vbProperCase)
End Select
Next Cell
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End With
End Sub
我注意到 Excel 2016 年 OSX 缺少一些库,我知道 MS 已经从 Excel 中删除了许多库 OSX.
对此有任何建议都很好。
您能否尝试避免使用 Range
对象的默认属性 - 它们可能在 Windows 和 OSX 之间有所不同:
所以,而不是:
Select Case True
Case Application.IsText(Cell) = True
Cell = UCase(Cell)
End Select
你能试试吗:
If Application.IsText(Cell.Value) Then
Cell.Value = UCase(Cell.Value)
End If
我 运行 在使我的宏与 OSX 兼容时遇到了一些问题,它在 windows.
上工作我有以下问题:
Compile error: Can't find project or library error when running the macro on Office 2016 on a MAC
代码/函数用于将特定范围更改为大写/正确大小写。调试器突出显示 "UCase(Cell)"
和 "Cell"
Sub ChkSheet()
'=========================================================================
' Format the cell boarders when the info needs to be corrected or updated
'=========================================================================
Dim historyWks As Worksheet
Set historyWks = Worksheets("Namelist")
Dim lRow As Long
Dim emailRng As Range
Dim Cell As Range
With historyWks
' Flags cells where the Email fieldcontains invalid characters
lRow = Range("G" & Rows.Count).End(xlUp).Row
Set emailRng = Range("Q2:Q" & lRow)
For Each Cell In emailRng
If Cell.Value = "," _
Or Cell.Value = " " _
Or Cell.Value = "wd" _
Or Cell.Value = "" _
Or Cell.Find("@") Is Nothing Then
Cell.Interior.Color = vbRed
Else:
Cell.Interior.ColorIndex = 0
End If
Next
'Change the text case
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each Cell In Range("NListUpper")
Select Case True
Case Application.IsText(Cell) = True
Cell = UCase(Cell)
End Select
Next Cell
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
'Change the case to proper
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each Cell In Range("NListProp")
Select Case True
Case Application.IsText(Cell) = True
Cell = StrConv(Cell, vbProperCase)
End Select
Next Cell
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End With
End Sub
我注意到 Excel 2016 年 OSX 缺少一些库,我知道 MS 已经从 Excel 中删除了许多库 OSX.
对此有任何建议都很好。
您能否尝试避免使用 Range
对象的默认属性 - 它们可能在 Windows 和 OSX 之间有所不同:
所以,而不是:
Select Case True
Case Application.IsText(Cell) = True
Cell = UCase(Cell)
End Select
你能试试吗:
If Application.IsText(Cell.Value) Then
Cell.Value = UCase(Cell.Value)
End If