Affecting cells positionally within a range

Excel VBA for Beginners 4-The Cells Collection object for dealing with Cells
5 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.14
List Price:  €119.21
You save:  €34.06
£74.68
List Price:  £104.56
You save:  £29.87
CA$137.64
List Price:  CA$192.70
You save:  CA$55.06
A$150.39
List Price:  A$210.55
You save:  A$60.16
S$128.91
List Price:  S$180.48
You save:  S$51.56
HK$778.15
List Price:  HK$1,089.44
You save:  HK$311.29
CHF 79.60
List Price:  CHF 111.44
You save:  CHF 31.84
NOK kr1,012.71
List Price:  NOK kr1,417.84
You save:  NOK kr405.12
DKK kr636.06
List Price:  DKK kr890.52
You save:  DKK kr254.45
NZ$172.81
List Price:  NZ$241.94
You save:  NZ$69.13
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,214.34
List Price:  ৳17,100.57
You save:  ৳4,886.22
₹9,071.34
List Price:  ₹12,700.24
You save:  ₹3,628.90
RM409.20
List Price:  RM572.90
You save:  RM163.70
₦145,133.48
List Price:  ₦203,192.68
You save:  ₦58,059.20
₨28,011.26
List Price:  ₨39,216.89
You save:  ₨11,205.62
฿3,142.13
List Price:  ฿4,399.11
You save:  ฿1,256.98
₺4,269.71
List Price:  ₺5,977.76
You save:  ₺1,708.05
B$541.91
List Price:  B$758.70
You save:  B$216.78
R1,681.81
List Price:  R2,354.61
You save:  R672.79
Лв166.53
List Price:  Лв233.15
You save:  Лв66.62
₩146,386.44
List Price:  ₩204,946.87
You save:  ₩58,560.43
₪321.04
List Price:  ₪449.47
You save:  ₪128.43
₱5,894.51
List Price:  ₱8,252.55
You save:  ₱2,358.04
¥15,495.23
List Price:  ¥21,693.94
You save:  ¥6,198.71
MX$1,797.13
List Price:  MX$2,516.05
You save:  MX$718.92
QR364.26
List Price:  QR509.98
You save:  QR145.72
P1,324.33
List Price:  P1,854.12
You save:  P529.78
KSh12,892.71
List Price:  KSh18,050.31
You save:  KSh5,157.60
E£4,748.49
List Price:  E£6,648.08
You save:  E£1,899.58
ብር15,617.37
List Price:  ብር21,864.95
You save:  ብር6,247.57
Kz91,205.27
List Price:  Kz127,691.03
You save:  Kz36,485.76
CLP$91,340.86
List Price:  CLP$127,880.86
You save:  CLP$36,540
CN¥704.64
List Price:  CN¥986.53
You save:  CN¥281.88
RD$6,354.07
List Price:  RD$8,895.96
You save:  RD$2,541.88
DA12,968.25
List Price:  DA18,156.07
You save:  DA5,187.81
FJ$225.35
List Price:  FJ$315.50
You save:  FJ$90.15
Q765.53
List Price:  Q1,071.77
You save:  Q306.24
GY$20,910.39
List Price:  GY$29,275.38
You save:  GY$8,364.99
ISK kr12,635.73
List Price:  ISK kr17,690.53
You save:  ISK kr5,054.80
DH919.51
List Price:  DH1,287.35
You save:  DH367.84
L1,689.61
List Price:  L2,365.52
You save:  L675.91
ден5,241.56
List Price:  ден7,338.40
You save:  ден2,096.83
MOP$801.46
List Price:  MOP$1,122.07
You save:  MOP$320.61
N$1,686.27
List Price:  N$2,360.84
You save:  N$674.57
C$3,678.63
List Price:  C$5,150.23
You save:  C$1,471.59
रु14,462.40
List Price:  रु20,247.95
You save:  रु5,785.54
S/336.50
List Price:  S/471.12
You save:  S/134.61
K430.77
List Price:  K603.10
You save:  K172.32
SAR375.15
List Price:  SAR525.23
You save:  SAR150.07
ZK2,306.35
List Price:  ZK3,228.98
You save:  ZK922.63
L433.42
List Price:  L606.81
You save:  L173.38
Kč2,067.88
List Price:  Kč2,895.12
You save:  Kč827.23
Ft32,789.63
List Price:  Ft45,906.80
You save:  Ft13,117.16
SEK kr928.77
List Price:  SEK kr1,300.32
You save:  SEK kr371.54
ARS$144,063.05
List Price:  ARS$201,694.03
You save:  ARS$57,630.98
Bs690.62
List Price:  Bs966.89
You save:  Bs276.27
COP$380,273.94
List Price:  COP$532,398.74
You save:  COP$152,124.79
₡49,997.35
List Price:  ₡69,998.29
You save:  ₡20,000.94
L2,631.45
List Price:  L3,684.14
You save:  L1,052.68
₲671,370.87
List Price:  ₲939,946.08
You save:  ₲268,575.20
$U3,917.97
List Price:  $U5,485.31
You save:  $U1,567.34
zł359.24
List Price:  zł502.95
You save:  zł143.71
Already have an account? Log In

Transcript

Hey guys, welcome back. So in this video, we're going to see how we can affect cells positionally within a range. Okay, so what does that mean? Well, basically, you can use the cells collection object to affect a certain cell within a range. And what that means is that you can select a range of cells. And you can say that you want to put a certain value in the fifth cell, for example.

So put the value of 100 in the fifth cell, for example, and you can make it in the sixth cell in the seventh cell and the 10th cell if this range contains 10 cells or more. Okay, so how do we know what the fifth cell for example within a range is? Or how does Excel determine that and how does the counting happen? Does it happen from left to write or from top to bottom and let's say that you finished the cells within a line in a range or in a row in a range. Do we make the cell below it the next cell? Or do we start from the very left on the new row?

Or how does that happen? Well, basically how the counting works is that we start counting from left to right. And then when we finish one row, within a range, we start counting the following cell from the following grow with from the very left, actually. So this is how the counting works. So we finished the cells in that row. Let's say that the range is from a one to D seven, for example.

So if we want to get the sixth cell, for example, so it would count 1234, and then the fifth is actually cell a two and then it's cell B two, basically, this is the sixth cell with within that range. Okay, so let's have An example basically, let's say I write cells, eight dot value is equal to 100. Okay, and when I write cells and then I write only just eight, between brackets, what that means is that I'm actually counting eight cells, starting from cell A one because I'm actually selecting all the cells in the sheet and I'm starting to count eight cells, and the first cell in the sheet is actually cell A one. So this is going to count 12345678. So it's going to be put in cell h1, basically. And remember, guys, when we were speaking about how we can determine which member of the collection we select, or we deal with the beginning of the course, and we actually put that example for sheets, and we were writing sheets, a dot activate, for example.

So So we said that he will actually select the eighth sheet. Okay, but the problem is that the sheets could change position. So this is not a good way to select sheets, but in case of the cells, the cells will not change positions. So this is not going to cause an issue. Okay? But anyways, you probably won't do that for all the cells, you probably do it in a certain range, but this is just an example.

So actually, what is gonna happen in this case is that it's gonna put the value of 100 in the eight cell in the cells collection objects is gonna count 12345678. So if you run that, you can see here that cell h1 has acquired the value of 100. Okay, so let's have another example. Let's say we right range a one to D 12 cells 15 dot value is equal to 100. Okay, so whereas range a one to D 12, this is actually range a one to D 12. So what that is going to do is that it's going to put the value of 100 in the 15th cell within that range.

So the 15th cell is going to be 1-234-567-8910 1112 1314 15. So it's going to be cell C four. So if you run that, you will see here that cell, c four has acquired the value of 100. Okay, guys, so this was how you can affect a cell within a range depending on its position. So this is how you can deal with a certain cell within a range depending on its position. I haven't needed to use that a lot.

But in case you need to use it, or in case you read it in somebody else's code, you'll be able to understand Stand what that means. Okay, so thanks guys for watching and I'll see you on the next one.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.