Macro example needed
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? |
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 |
All times are GMT +1. The time now is 03:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com