VBA basics
8. What is putting a character in a cell (Range, Value)

Excel macro basics and applications, introduction to Excel VBA
last updated:09-01-2019

8. What is putting a character in a cell (Range, Value)

Some of this topic was processed by machine translation. Original

Let's take a closer look at the macro that we ran last time.

Why is the value in the cell now,
How to read VBA,

I will explain in a little more detail.

Sub practice1()
  Range("A1") = "Hello!"
End Sub

Anyway, now I can see that "Good morning!"
If you want to put characters in a cell,
Range("cell address") = "letters"
The cell address is the column symbol + row number. It is A1 because it is the cell in the first row of column A.

This "=" may be a little difficult to understand,
Think of "=" in this case as "←".
The right side of "=" is to put the specified character / number on the left side.
Like the sheet function, the characters are enclosed in double quotes.

Anyway, now you can put characters in the cell.
Range( "B2") = "Hello"
Then enter "Bello" in cell B2.
I wrote "I will enter", but it means that the character is displayed in the cell.

A cell has various aspects.
Displayed characters, character size, character color, background color, ruled lines, etc.
What do you want to do in the cell ...
Here, characters are entered as cell values.

Because it puts in the value

Range("cell address").Value = "character"

Write like this.
Put a character in the value of the cell.
However, .Value does not have to be written, so .Value can be omitted.

When handling something other than a value, for example, when specifying the size of a character,

Range("cell address"). Font.Size = 11
In this way, various specifications are required after the cell.
(This will be explained gradually in the future.)

Here, a cell is called an object.
And Value is called a property.

That means

Enter a value in the object property.
Range("cell address").Value = "character"
Put a character in the cell value.
Characters are entered in the Value property of the Range object.

Object; property = value
In this way, specify the property by putting "." After the object.
Then, enter a value with "=".

There are many other things called this object.
Both worksheets and books are objects.
The cell is called a Range object.
Range objects have many properties.

Objects are features and properties are attributes.

If I can drink the canned beer now
The amount of beer is Value.
There are various types of beer inside, including lager to dry.
There are various printed on the surface of the can.
These are properties.

To display a character in a cell
It is to put a character in the Value (property) of a cell (Range object).
As a result, the character will enter the specified cell.

It's hard to understand the terms object and property right away.
First of all, just remember to say that.
Detailed explanations on these will be made gradually over time.

Articles with the same theme "VBA basics"

5. VBE Set Options (Option Explicit)
6. Let's write it anyway (Sub, End Sub)
7. To run a macro (F5)
8. What is putting a character in a cell (Range, Value)
9. How to specify cells in Range
10. Specification method other than Range (Cells, Rows, Columns)
11. How to use Range and Cells
12. Variables and data types (Dim)
13. Constants and type declaration characters (Const)
14. Character concatenation and continuation line
15. Four arithmetic operations and annotations (comments)

  • >
  • >
  • 8. What is putting a character in a cell (Range, Value)

  • If you find this site useful, please share and bookmark.

    I'm going to pay close attention to the description,
    If you have any mistakes or suggestions,「Contact Us」I hope you will let me know.
    Use the posted VBA code at your own risk.
    We are not liable for any damages such as data corruption.

    If you find this site useful, please share and bookmark.
    To the bottom of the text