Appropriate use of cell reference when creating macros

L

L'il Ginny

I have two questions: 1-i'm trying to create a very simple macro that will
extract certain text from a cell and move it to the cell to the right. The
full text is L+300...i want to copy just the 300, and move it. I want to do
this for a column of cells that contain L+###. I've read posts that say the
edit function doesn't work with macros (which, by the way is NEVER mentioned
on excel help...), so how do you "get into" the cell to do this? Also, i've
tried to use the cell reference tool on the 'stop record' toolbar with no
success. HOw does this work, exactly? do you reference the target cell or
the original? neither worked...
2- (stupid question) is there a way to enter this discussion area directly
w/o going thru excel's help function (like, is there a direct web address?)
 
G

Gary''s Student

Select the column and try this macro:

Sub ginny()
Set r = Intersect(Selection, ActiveSheet.UsedRange)
For Each cell In r
If Left(cell.Value, 2) = "L+" Then
cell.Offset(0, 1).Value = Right(cell.Value, 3)
End If
Next
End Sub

It will ignore any values in the column that do not begin with "L+"
 
L

L''il Ginny

yes, it's overkill, agreed - i was trying to just learn how to use the macro
function because my list is probably 600 rows long...i'll try your formula,
tho...do you have any advice on the cell reference in general? there's no
guidance whatsoever on excel help...thx!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top