Thread
:
Formatting help
View Single Post
#
5
Posted to microsoft.public.excel.programming
keri
external usenet poster
Posts: 74
Formatting help
This is working just perfectly. Thankyou for your invaluable help.
Charles Chickering wrote:
Keri, if this does not work please email the workbook to
--
Charles Chickering
"A good example is twice the value of good advice."
"Charles Chickering" wrote:
Perhaps we need to specify the Search direction in the first find statement:
Set rSearch = Sheets("cardata" & k).Range("B:B"). _
Find(What:="P", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
--
Charles Chickering
"A good example is twice the value of good advice."
"keri" wrote:
I have discovered two more things.
I can run this code AFTER I have put each of these "tables" into
another sheet, which solves the problem I was wittering on about above!
However the code is only finding the first P and moving it into the
first column. I need it to search all the cells below this column and
move the P across into the first column if it exists.
Secondly I have tried to get this code to look through my sheets as
below but it doesn't like it (suprise suprise seeing as I wrote it!).
(Answer is already defined as a global variable)
Dim k As Integer
Dim rSearch As Range
Dim rFirst As Range
For k = 1 To answer
Set rSearch = Sheets("cardata" & k).Range("B:B").Find(what:="P",
LookAt:=xlPart)
If rSearch Is Nothing Then Exit Sub
Set rFirst = rSearch
Do
rSearch.Offset(, -1) = rSearch.Offset(, -1) & "P"
rSearch.FindNext After:=rSearch
Loop Until rSearch.Address = rFirst.Address
rSearch.EntireColumn.Delete
Next k
End Sub
Thanks experts!
Reply With Quote
keri
View Public Profile
Find all posts by keri