View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Can someone please tell this newb what he's doing wrong?

Hi SanFranGuy06,

I slightly adapted your first procedu

'=============
Public Sub Format_Data()
Dim i As Long

i = 2
Do While Cells(2, i).Value < ""
If InStr(1, Cells(1, i), "Sedol", vbTextCompare) Then
Columns(i).Cut
Columns("A:A").Insert Shift:=xlToRight
End If
i = i + 1
Loop

End Sub
'<<=============


---
Regards,
Norman



"SanFranGuy06" wrote in message
ups.com...
i can't get either of these to work :o(

Sub Format_Data()

Dim i As Long
i = 1
Do While Cells(2, i) < ""
If InStr(1, Cells(1, i), "Sedol", vbTextCompare) Then
Columns(i).Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Else
i = i + 1
End If
Loop

End Sub

----------------------------------------------------------------------------------------------------------------

Sub Format_Data2()

Dim rCell As Range, i As Long
i = 1
Do
Set rCell = Nothing
Set rCell = ActiveSheet.Columns(i).Find("Sedol", , xlValues,
xlPart)
If Not rCell Is Nothing Then
rCell.EntireColumn.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
End If
Loop While Not rCell Is Nothing
Exit Sub
NoneFound:
MsgBox "Sedols Not Found"

End Sub