Trying to write a macro
Hi John
let's give it a try
first of all, we need a loop, which loops 45 times, corresponding to the
rows you want to search through:
for i = 1 to 45
next i
after that we need to check if in this row the cell in column D is empty so
inside of the loop:
if cells(i, 4).formular1c1 = "" then
end if
now if the code finds a empty cell we have to enter data to the column f so
inside of the if:
cells(i,6).formular1c1 = "Whatever you like"
and now you want to put a value on another sheet:
sheets("yourotherpage").cells(x,y).formular1c1 = "Something else or whatever"
so the final code will look something like this
for i = 1 to 45
if cells(i, 4).formular1c1 = "" then
cells(i,6).formular1c1 = "Whatever you like"
sheets("yourotherpage").cells(x,y).formular1c1 = "Something else or
whatever"
end if
next i
hth, otherwise, just ask
Carlo
"john mcmichael" wrote:
I am trying to write a macro that begins a search about 45 rows from the top
of a spreadsheet. It will search column D for cells that not empty. When it
finds one, the macro should copy a coresponding value in column F and place
that value on another page in my workbook. This process needs to loop until
all non empty cells in column D have their corresponding column F values
copied and pasted. The problem is that I'm not very good with VBA or macros?
Can you help with this?
Thanks in advance and have a great day.
|