Appropriate use of cell reference when creating macros

  • Thread starter Thread starter L'il Ginny
  • Start date Start date
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?)
 
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+"
 
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!
 
Back
Top