Copy/Paste from once cell to another

E

ebraun01

Is there a way to create a macro or formula that will copy just the
first word of a cell and past it into a new cell? To take that
further, copy the first word out of each cell in a column and past
those into cells within a new column?
 
E

ebraun01

Perfect, works great. Now is there a way to tell it when to run at a
time of my choosing. In other words I would prefer to not just have the
formula within the cells but to hit a button or run a macro and have the
formula ran.
 
D

Don Guillett

Sub getfirstword()
lr=cells(rows.count,"f").end(xlup).row
For Each c In Range("f9:f" & lr)
offset(, 1) = Left(c, InStr(c, " ") - 1)
Next
End Sub
 
E

ebraun01

Thanks Don, I really appreciate your great help.

That looks like to much information for a cell formula..where does that
go?
 
D

Don Guillett

You did ask for a macro, didn't you? use alt f11 to put into a module and
then assign to a button or run from alt f8
 
E

ebraun01

Your right, I did ask for a macro.. must have taken my stupid pill that
day.

I created a macro and ran it and received a compile error. "sub or
function not defined" with "-Offset(, 1) =" -highlighted in blue. Do I
need to put something after the = but before the word "left"?
 
D

Don Guillett

should be
c.offset

Sub getfirstword()
lr=cells(rows.count,"f").end(xlup).row
For Each c In Range("f9:f" & lr)
c.offset(, 1) = Left(c, InStr(c, " ") - 1)
Next
End Sub
 
Top