View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro example needed

Kind of low on the details...

But maybe this'll give you a start.

Option Explicit
Sub testme01()
Dim myCell As Range
Dim myRng As Range
Dim FirstStr As String

FirstStr = "whatever"

With Worksheets("sheet1")
Set myRng = .Range("c1", .Cells(.Rows.Count, "C").End(xlUp))
End With

For Each myCell In myRng.Cells
If InStr(1, myCell.Value, FirstStr, vbTextCompare) 0 Then
'put some value in the same row, 6 columns to the right
myCell.Offset(0, 6).Value = Mid(myCell.Value, 12)
myCell.Value = Left(myCell.Value, 11)
End If
Next myCell
End Sub


mscertified wrote:

I need a macro to do the following:
Read thru every row looking at a particluar column.
When I find a certain text string in the column, extract another string from
the column and place it in another column.
Delete the string from the original column.
Continue to last row.

Can anyone give me an exapmle of a macro doing something similar?


--

Dave Peterson