![]() ![]() Step 3: Activate sheet 2 first to use its properties. Step 2: Declare a macro name for this example. Step 1: Click on the Insert Tab and add the module I want to change the strings in column A, which are in upper case, to lower case in column B. For demonstration, my data is in Sheet 2, which is as follows, Now in this example, let us change a range of data from upper to lower case using the LCase function. We can see that Lcase does not affect any of the special characters in the string. Step 6: Execute the above code using the run button and see the following result. Step 5: Now, let us use the LCase function on cell C1 to check whether it affects the special characters or not. Step 4: To use the string in cell C1, we need to activate sheet 1 first. Step 3: Declare a third macro name using the Sub Function. Step 2: Click Insert and add the module above to let us write the code in the same module. I have a string in cell C1 with some special characters for demonstration. Click on OK to see the result.Ībove, we have discussed how this Lcase function does not affect the structure of the string, i.e., if there is a comma, a semicolon, or any other special character, it remains unaffected. ![]() Step 8: Run the above code by pressing F5, and we get a prompt to give a value. Step 7: Use the Msgbox Function to display the result. Step 6: In the B store, the value of the Input string is changed from upper case to lower case using the Lcase function. Step 5: Use the Inputbox function to take input from the user and store the value in variable A.Ī = InputBox("Write a string", "In Uppercase") Step 4: Use Dim to declare two variables, A and B, as strings. Step 3: Declare a second macro different from the first one, as two macros cannot have the same name. Step 2: Click on the Insert tab and add a new module. Step 1: Again, we start by going to VB Editor from Visual Basic under the developer’s tab. Let us take input from the user in the Upper case and change the value of the text to lower case using the Lcase function. We changed the text from upper to lower case in the above example using the Lcase function. Step 6: We get the following result when we run the above code. Step 5: Now, let us change the value in cell A1 by using the LCase Function as follows. Step 4: To use any of the sheet properties, we must first activate the sheet. Step 3: Then declare a macro Sub Function. To start writing the code, double-click on the module. Step 2: Now click on the Insert tab, which will show us to insert a module in the VBA. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |