Finding the next row

Excel VBA for Beginners 8- Must know Excel Logic
4 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.87
List Price:  €120.23
You save:  €34.35
£74.39
List Price:  £104.15
You save:  £29.76
CA$138.18
List Price:  CA$193.46
You save:  CA$55.28
A$153.39
List Price:  A$214.75
You save:  A$61.36
S$128.92
List Price:  S$180.49
You save:  S$51.57
HK$779.80
List Price:  HK$1,091.76
You save:  HK$311.95
CHF 80.49
List Price:  CHF 112.70
You save:  CHF 32.20
NOK kr1,009.67
List Price:  NOK kr1,413.58
You save:  NOK kr403.91
DKK kr641.01
List Price:  DKK kr897.45
You save:  DKK kr256.43
NZ$170.65
List Price:  NZ$238.92
You save:  NZ$68.26
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,159.63
List Price:  ৳17,023.97
You save:  ৳4,864.33
₹8,813.74
List Price:  ₹12,339.59
You save:  ₹3,525.84
RM422.70
List Price:  RM591.80
You save:  RM169.10
₦152,684.73
List Price:  ₦213,764.73
You save:  ₦61,080
₨28,172.18
List Price:  ₨39,442.18
You save:  ₨11,270
฿3,233.20
List Price:  ฿4,526.62
You save:  ฿1,293.41
₺4,116.73
List Price:  ₺5,763.58
You save:  ₺1,646.85
B$546.03
List Price:  B$764.47
You save:  B$218.43
R1,779.46
List Price:  R2,491.32
You save:  R711.85
Лв167.77
List Price:  Лв234.89
You save:  Лв67.11
₩139,375.48
List Price:  ₩195,131.24
You save:  ₩55,755.76
₪336.41
List Price:  ₪470.99
You save:  ₪134.57
₱5,711.89
List Price:  ₱7,996.87
You save:  ₱2,284.98
¥14,830.67
List Price:  ¥20,763.54
You save:  ¥5,932.86
MX$1,876.23
List Price:  MX$2,626.81
You save:  MX$750.57
QR364.02
List Price:  QR509.64
You save:  QR145.62
P1,342.46
List Price:  P1,879.50
You save:  P537.04
KSh12,918.70
List Price:  KSh18,086.70
You save:  KSh5,168
E£4,854.20
List Price:  E£6,796.08
You save:  E£1,941.87
ብር14,292.55
List Price:  ብር20,010.15
You save:  ብር5,717.59
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$96,831.31
List Price:  CLP$135,567.71
You save:  CLP$38,736.40
CN¥713
List Price:  CN¥998.24
You save:  CN¥285.23
RD$6,296.92
List Price:  RD$8,815.94
You save:  RD$2,519.02
DA12,990.59
List Price:  DA18,187.34
You save:  DA5,196.75
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q765.93
List Price:  Q1,072.34
You save:  Q306.40
GY$20,890.84
List Price:  GY$29,248.01
You save:  GY$8,357.17
ISK kr12,333.76
List Price:  ISK kr17,267.76
You save:  ISK kr4,934
DH908.31
List Price:  DH1,271.67
You save:  DH363.36
L1,670.58
List Price:  L2,338.87
You save:  L668.29
ден5,277.34
List Price:  ден7,388.49
You save:  ден2,111.14
MOP$802.43
List Price:  MOP$1,123.43
You save:  MOP$321
N$1,761.48
List Price:  N$2,466.14
You save:  N$704.66
C$3,674.73
List Price:  C$5,144.77
You save:  C$1,470.03
रु14,082.30
List Price:  रु19,715.79
You save:  रु5,633.48
S/353.21
List Price:  S/494.51
You save:  S/141.30
K416.61
List Price:  K583.27
You save:  K166.66
SAR375.17
List Price:  SAR525.25
You save:  SAR150.08
ZK2,374.72
List Price:  ZK3,324.71
You save:  ZK949.98
L436.04
List Price:  L610.48
You save:  L174.43
Kč2,099.65
List Price:  Kč2,939.59
You save:  Kč839.94
Ft33,821.21
List Price:  Ft47,351.04
You save:  Ft13,529.83
SEK kr945.93
List Price:  SEK kr1,324.34
You save:  SEK kr378.41
ARS$136,092.68
List Price:  ARS$190,535.20
You save:  ARS$54,442.52
Bs690.01
List Price:  Bs966.04
You save:  Bs276.03
COP$400,414.31
List Price:  COP$560,596.05
You save:  COP$160,181.74
₡50,481.69
List Price:  ₡70,676.39
You save:  ₡20,194.69
L2,617.73
List Price:  L3,664.93
You save:  L1,047.20
₲721,217.97
List Price:  ₲1,009,734.02
You save:  ₲288,516.04
$U4,006.62
List Price:  $U5,609.43
You save:  $U1,602.81
zł365.33
List Price:  zł511.47
You save:  zł146.14
Already have an account? Log In

Transcript

Hey guys, welcome back. So in this video, we're going to see how to get to the next row and that is the row after the last row on our data set. And we would want to do that in order to add new rows to our data set, for example. So how can we get the row number for the next row? Well, it's very simple, you could just do the same one here, the same formula for getting the last row, except that you're just going to add a plus one. So this formula for getting the last row yields an integer, which is the last row, if you add a plus one, two that you go to the next row, right, so then you can start typing values on the row that is the next row.

So in our case here, if you start typing values, we're going to start typing values on row number 20. So you could write for example, cells, the row index number is going to be nr, then comma one, we're going to type in the first column Which is the name we're going to type for example jack and then sells an r comma two, which is the day it's going to be equals date serial. Let's enter a random day 2016 oh 705 for example, I'm actually going to copy that here. So comma three is equal to, we're going to put an item so say 15. And then the one that is comma four, which is for the fourth column, let's say we're going to type the sales amount to be 100,000. So if you run this code, we actually going to go through it step by step here, and r is equal to 20.

This is the next row we're going to start executing these statements. So on the value for the next row and first column is going to be jack and then the date and then 15 and then 100,000. Okay, so this is how you can get the value for The next row is very easy. Now there is another way actually, that people use sometimes sub next row other way. That's great and use a procedure here. And what some other people do as well to go to the next row is actually using the range object.

So range for example here. And then remember guys, when the range object, we just entered a reference for the cell. So let's say we're going to enter range a, and then concatenate on that and the value of our, okay in this way, we got a range, for example, a 21, because the next row we're going to type on is a 21. So a 21 is going to be equal to Jason, whatever. And then we could do B and concatenated on an R is going to be date serial, whatever. 2016 Oh, 403 Or example, and then range C and N or N percent and or is equal to 12, for example, and then d m percent n or is equal to 50,000, for example, this is another way of actually referring to cells when you have variables, although it's less common way, and it's the less recommended way.

So using the cells collection object is better. But sometimes people do that. So they would refer to a cell if the row number is a variable, do just concatenate the column name, which is your column A, for example, on using the ampersand on the nr and the ampersand is actually used when you need to concatenate text, you know, a piece of text on another piece of text and we'll see that a lot actually in the course. And you do that in Excel and they normally Excel we need to concatenate a piece of text on a piece of text. You The M percent as well. You should be familiar with that.

Okay, so if you're on this code, we're going to have these values pop on, roll 21. Okay, so this is another way that people could write it. I'm just showing you that so that if you see in somebody else's code, you wouldn't feel that is weird. Okay, guys. So that's it for the next row. Thank you very much for watching this video 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.