"visual basic excel remove spaces" Code Answer's
You're definitely familiar with the best coding language BASIC that developers use to develop their projects and they get all their queries like "visual basic excel remove spaces" answered properly. Developers are finding an appropriate answer about visual basic excel remove spaces related to the BASIC coding language. By visiting this online portal developers get answers concerning BASIC codes question like visual basic excel remove spaces. Enter your desired code related query in the search bar and get every piece of information about BASIC code related question on visual basic excel remove spaces.
visual basic excel remove spaces
' NOTE: this function is for Microsoft Excel only (language: VBA)
'===============================================================================
'>> RemoveSpaceCharsInSelectedCells()
'===============================================================================
' Removes the spaces in the selected cells
'===============================================================================
Sub RemoveSpaceCharsInSelectedCells()
Dim sFunct As String: sFunct = "RemoveSpaceCharsInSelectedCells"
Dim bDebugging As Boolean: bDebugging = False
If (bDebugging = True) Then
Debug.Print Format(DateTime.Now, "hh:mm:ss") & " INFO " & sFunct & "| " _
& "Running.. [Cells:" & Selection.Address & "]"
End If
'*********************************
' VALIDATIONS and declarations
'*********************************
'(DECLARATIONS)
Dim wbInit As Workbook: Set wbInit = ActiveWorkbook
Dim wsInit As Worksheet: Set wsInit = ActiveSheet
Dim s_rInit As String: s_rInit = Selection.Address
Dim sErrMsg As String
Dim sReplaceRng As String
Dim sReplaceString As String
Dim sNewString As String
'(SETTINGS/SETUP)
Application.ScreenUpdating = False
sReplaceRng = Selection.Address
' sReplaceString = " "
sNewString = ""
'---------------------------------
' WORK
'---------------------------------
'1) Replace the relevant cells containing the sReplaceString
' a) Remove the normal space value (ascii: 32)
' b) Remove the html space value (ascii: 160)
' c) Remove the html space value (ascii: nbsp)
'Z) Reactivate the initial workbook/worksheet
'--(1.a)
sReplaceString = Chr(32) ' normal space (ascii: 32)
Selection.Replace What:=sReplaceString, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
'--(1.b)
sReplaceString = Chr(160) ' html number's space (ascii: 160)
Selection.Replace What:=sReplaceString, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
'--(1.c)
sReplaceString = Chr(nbsp) ' html name's space (ascii: 160)
Selection.Replace What:=sReplaceString, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
'--(Z)
wbInit.Activate
wsInit.Activate
Range(s_rInit).Select
'-----------v-----------DEBUG INFO-----------v-----------
If (bDebugging = True) Then
Debug.Print Format(DateTime.Now, "hh:mm:ss") & " INFO " & sFunct & "| " _
& "Complete for cells [" & Selection.Address & "]"
End If
Application.ScreenUpdating = True
End Sub
All those coders who are working on the BASIC based application and are stuck on visual basic excel remove spaces can get a collection of related answers to their query. Programmers need to enter their query on visual basic excel remove spaces related to BASIC code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about visual basic excel remove spaces for the programmers working on BASIC code while coding their module. Coders are also allowed to rectify already present answers of visual basic excel remove spaces while working on the BASIC language code. Developers can add up suggestions if they deem fit any other answer relating to "visual basic excel remove spaces". Visit this developer's friendly online web community, CodeProZone, and get your queries like visual basic excel remove spaces resolved professionally and stay updated to the latest BASIC updates.