

Then, run the code by clicking on the Run Sub button or using the keyboard shortcut F5 key.As same as above examples, first, right-click on the sheet then select View Code.In column B we can see that there are positive values, negative values as well as zero. The dataset contains some numeric values. For this, we are going to use the dataset below. Now we will see the result in our excel sheet. In earlier examples, we saw the conversion in a MsgBox. Convert a Numeric Value to String in a Cell in Excel Sheet Now, press the F5 key or click on the Run Sub button to run the code.Ĥ.MsgBox "Zero to a String : " & sOut, vbInformation, "VBA Str Function" Now, copy and paste the VBA code below.This will appear in the Visual Basic Editor.By the same token, right-click on the sheet, then select View Code.The number zero ( 0) also can be converted as string data. VBA Str Function to Transform Number Zero to String MsgBox "Negative Number to String : " & sOut, vbInformation, "VBA Str Function"ģ. Similarly as an earlier example, now, write down the VBA Code to convert the negative numeric data ( -70) to string data.Likewise, in the previous example, we take an input then will see the output in the MsgBox.This will take you to the Visual Basic Editor field, where we can write VBA Macros.Or, right-clicking on the worksheet will open up a window.In the beginning, go to the Developer tab > Visual Basic > Insert > Module.In this example, we will see the VBA Str function can also convert the negative value to a string. Now, run the code by pressing F5 or clicking the Run Sub button.MsgBox "Positive Number to String : " & sOut, vbInformation, "VBA Str Function" Now we want to see the result in a Msgbox. In the VBA Code, we input an integer 70 as iIn and want to view the output as a string, we name the output as sOut.Or, we can simply right-click on the sheet and select View Code.

Now, go to Insert and select Module from the drop-down menu.This will open up the visual basic window.Firstly, go to the Developer tab on the ribbon.In this example, we will convert a positive integer value into string data. Change Positive Numeric Value to String with VBA Str Function Let’s have a look at some examples of Excel VBA Str Function. VBA Str function is a string/text function that turns the numerical data into string data. Excel VBA has also a list of different categorical functions. There are countless build-in functions in excel. This number is a numeric value that is converted as string data.Įxcel office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011, Excel 2010, Excel 2007, Excel 2003.Ĥ Different Examples of Using VBA Str Function
