i'm going to show you how to populate
information from one sheet the other
sheets automatically using vba now on in
like a little consulting business i have
I record the work order number the
customer number the description on the
consultant who worked on it the hours
and the rate and the total so that would
be my first sheet that I care about the
second thing would be the work order
number customer number in the total so i
can keep track of who's paid me or not
and the third sheet i would have is I
would basically just have a consultant
that's working on the project and the
work order number so just so that you
don't have a consultant working on too
many projects at the same time so let's
go back to our our first sheet and let's
go to our Developer tab and let's start
so let's start a new module here so
let's go sub and i'm going to call and
i'm going to call this populate so then
the first thing that we need to do is
declare our values so I'm first you
declare and I call the first value last
row as long
and then I'm gonna and then i'm going to
declare my end row as long as well so
the first thing that I'm going to do is
I'm going to define what the last row is
so the last row is the the last row that
i've entered in in my first sheet so
let's go last row equals equals sheet 1
dot cells rows.count one and we're going
down to the bottom and then we're coming
up to the last role here
ok so that's defined our last row and
now what we're going to do is we're
going to we're going to move to the
second sheet and if you remember there
we want to have our our information so
we see for pay
so we're going to do it and roll so we
want we don't want the last row we want
the 1st Blank is what we want here and
so we're going to go 0 equals sheet too
because that's where we are now that
sells and then i'm going to go at the
beginning so 1, 1 and then i'm going to go
current region dot rows dot count and I'm
going plus1 ok so that's found our end
roll on our second sheet now let's tell
tell on the system which what we'd like
to copy to the second sheet so the first
cell the second sheet we would like the
work order number so let's go sheet two
cells and then we're gonna define it as
we're going to define it as the end row
end row and the first column okay and
then we're going to go is equal to and
then we're going to go sheet one the place
that we're taking this information from
is the last roll at first cell
ok so now what we're going to do is we
are going to copy this two more times
ok
and one more time we want to the second
call now and we'd like to bring over the
second column from the first sheet as
well and now we want the third column on
the second sheet and we would like to
bring over the seventh column from the
from the first sheet
ok so that's got the second sheet
complete now so now let's move to the
third sheet so let's copy this from the
top here for end row for the second sheet
and let's put it down here and let's go
let's changes to the third sheet because
this is where we want to keep track of
what our consultants are doing right so
what we're going to do is we are going
to go and I will do the same thing as
i'll do some more copy here saves me
typing so we're going to go she three
and we want on the end row and we want the
first column and it to say on sheet1
cells last row column for and then we're
gonna copy this again and we would like
the second column of the first sheet to
be from the last from the last row of
the first sheet in the first cold so
we'd like to have the consultant and the
work order number because I'm not a
wonderful type is I'm going to debug
this and the pilot see if I have any
typing errors
ok so now let's run this
ok so here we have our information on
the first there we have our
information on the second sheet and
there we have our information on the
third sheet so that's how you are to
populate from one sheet to the other
using vba please subscribe