Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Can someone please tell this newb what he's doing wrong?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help a newb.... gibson00 Excel Discussion (Misc queries) 6 July 11th 06 02:21 PM
Complete newb, I know! grahamhurlburt Excel Programming 2 December 23rd 05 09:15 PM
i know this has to be so easy -newb chris_ Excel Discussion (Misc queries) 6 July 11th 05 09:57 PM
VBA newb needing help with an IF duster Excel Programming 4 June 27th 04 10:28 PM
VBA newb needing help with an IF duster Excel Programming 0 June 27th 04 10:18 PM


All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"