PROVIDING ACCURATE, RELIABLE AND STRAIGHT TO THE POINT KNOWLEDGE ABOUT DIFFERENT IT TOOLS EXPLAINED WITH PRACTICAL EXAMPLES

CONTENTS

HOW TO INSERT STRINGS IN EXCEL USING VBA

INTRODUCTION

STRINGS is the specific term given to the normal Text in the programming languages.
Strings are very important component in any program as this is the only part of the language through which the program communicate with the user.
We ask the user for the input through a STRING.
We process the user input.
We return the output to the user through a STRING.
So we can understand the importance of Strings in VBA.
Many times we need to handle strings very carefully for which we need to know several types of manipulations so that we can make our application can communicate effectively.

” STRINGS ARE THE ONLY WAY THROUGH WHICH OUR APPLICATIONS COMMUNICATE WITH THE USER”
 
So, we’ll learn many types of STRING MANIPULATIONS in this article.
 

 

WHAT IS A STRING IN VBA

Simple text is a String.
String is a collection of characters. As we know programming languages considers the characters as the basic unit. So when characters combine STRINGS are formed.
e.g.
“WELCOME TO GYANKOSH.NET” is a String.
IF THEN ELSE construct
starts with the IF instruction followed by the CONDITION which we want to decide.
After condition comes the keyword THEN after which comes the instructions which should be executed
if the condition is true.
There are few optional keywords also.
IF WE WANT TO CHECK MORE THAN ONE CONDITION MAKE USE OF ELSEIF.
For the NON APPLICABILITY of the given condition make use of ELSE which will have the instructions to be executed if the condition is not true.
If is ended by END IF.
*If it doesn’t have many instructions there is not need of END IF.
 

INSERTING THE STRING / TEXT INTO CELL

OBJECTIVE

ENTER THE TEXT “WELCOME TO GYANKOSH.NET” INTO THE CELL D3 USING VBA.

Make use of VBA to enter the given text into cell positioned at location D3.

PLANNING THE SOLUTION

In this case we simply need to send the String to the cell.

Steps:

1. Select the cell.

2. Put the string into the cell.

CODE

‘ gyankosh.net
‘ putting a custom text/string in a specified cell


Sub stringtocell()


Range(“d3”).Value = “WELCOME TO GYANKOSH.NET”


End Sub

EXPLANATION

There is just one statement in the code.
Range(“d3”) refers to CELL D3
.VALUE refers to the value of D3.
So we put the value of D3 as String “WELCOME TO GYANKOSH.NET”

RUNNING THE CODE AND OUTPUT

PUTTING TEXT IN A CELL VBA
VBA -PUTTING A TEXT IN A CELL

OTHER WAYS TO REACH THIS ARTICLE

  • WHAT IS EXCEL, HOW EXCEL WORKS, WRITE FORMULA IN EXCEL, EXAMPLE OF USING FORMULA IN EXCEL, ANIMATED EXAMLPE OF USING FORMULA IN EXCEL

LEARN

Encourage us by following at …

If you have any queries or suggestions or any problem which you would like us to solve for you, kindly mail at

[email protected]

Pin It on Pinterest

Share This

KINDLY SPEND FEW SECONDS HERE....

  • PICTURES ARE TOO SMALL?? Don’t worry, Click them, and pinch zoom to see them properly. All pictures are in high resolution.
  • KINDLY LIKE OUR FACEBOOK PAGE BY CLICKING HERE  AND IF WE NEED TO IMPROVE, KINDLY SEND US THE FEEDBACK ON [email protected]
  • Didn’t get what you were looking for?? Just put your question in the chat box present in the Right Lower corner. Name and email id [No spamming, just for the answer of your requirement] are needed.
*CLICK ANYWHERE ELSE TO CLOSE THIS WINDOW
%d bloggers like this: