English 中文(简体)
如何检查外壳细胞价值有空间......
原标题:How to check that excel cell value has spaces... excel 2007

I have an Excel file that contains some values. I need to check if a cell value contains spaces. For example, sometimes a user will write some values in the cell but mistakenly press Enter or Space in the cell. I want to see if the cell value has spaces inside... Please tell me how to do this.

增 编

最佳回答

请允许我在A1号单元(ABC)中说一式“ABC”,然后是一块空间。 这两种公式应有助于:

=LEN(A1)=LEN(TRIM(A1))

=EXACT(A1,TRIM(A1))

缩略语:

Function HasSpaces(rng As Excel.Range) As Boolean
  HasSpaces = Not (Len(rng.Value) = Len(Trim$(rng.Value)))
End Function

样本使用:

Sub tst()
  Debug.Print HasSpaces(Range("A1"))
End Sub
问题回答

暂无回答




相关问题
Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Outlook 2007 CommandBarControl.Execute won t work

I recently switched to Outlook 2007 and noticed that my VBA-macros won t work. I use the following code to open a new appointment-item (and fill it automatically). It worked perfect in Outlook 2003, ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...

热门标签