
如何檢查Excel中指定單元格中的第一個字母是否為大寫?
在Excel的單元格中將所有字母都大寫可能很容易。 但是,您知道如何僅檢查Excel中指定單元格中的第一個字母是否為大寫嗎? 本文將介紹VBA代碼以幫助您實現它。
使用VBA代碼檢查指定單元格中的第一個字母是否為大寫
使用VBA代碼檢查指定單元格中的第一個字母是否為大寫驚人的! 在 Excel 中使用高效的選項卡,如 Chrome、Firefox 和 Safari!每天節省50%的時間,并減少數千次鼠標單擊!請執行以下操作以應用VBA代碼檢查Excel中單元格中的第一個字母是否為大寫。
1。 按 其他 + F11 同時打開 Microsoft Visual Basic應用程序 窗口。
2.在 Microsoft Visual Basic應用程序 窗口,請點擊 插頁 > 模塊。 然后將以下VBA代碼復制并粘貼到“代碼”窗口中。
VBA代碼:檢查單元格中的第一個字母是否為大寫
Sub UpperCaseCheck()Dim xRg As RangeDim xAsc As IntegerSet xRg = Range("A1")xAsc = Asc(Mid(xRg.Value, 1, 1))If xAsc > 64 And xAsc < 91 ThenMsgBox "First alpha character is capital"ElseMsgBox "First alpha character is not capital"End IfEnd SubCopyNote: In the code, A1 is the cell which you will check if the first letter is capital. Please change it as you need.3. Press the F5 key to run the code. Then a Microsoft Excel dialog box pops up to tell you whether the first letter in that specified cell is capital or not as below screenshots shown.Related Articles:How to check if a cell value is between two values in Excel?How to check if cell begins or ends with a specific character in Excel?Best Office Productivity ToolsTransform Hours into Minutes with Kutools for Excel!Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed!Why You Need Kutools for Excel
