Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Limit .find to one pass

The following code loops through certain columns and removes the last
character in the data. My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...

How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.

thanks
Robert

Do Until ActiveCell.Value = ""

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
False, SearchFormat:=False).Activate

ActiveCell.Offset(1, 0).Select

Do Until ActiveCell.Value = ""

'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column

Loop
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Limit .find to one pass

Hi Robert

I think this should do it:

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = ""
'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column
FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address

Regards,
Per

"Robert H" skrev i meddelelsen
...
The following code loops through certain columns and removes the last
character in the data. My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...

How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.

thanks
Robert

Do Until ActiveCell.Value = ""

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
False, SearchFormat:=False).Activate

ActiveCell.Offset(1, 0).Select

Do Until ActiveCell.Value = ""

'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column

Loop


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Limit .find to one pass

One way:

Dim rFound As Range
Dim sAddr As String
With ActiveSheet.Cells
Set rFound = .Find( _
what:="LC", _
after:=.Item(.Rows.Count, .Columns.Count), _
LookIn:=xlValues, _
Lookat:=xlPart, _
searchorder:=xlByColumns, _
searchdirection:=xlNext, _
MatchCase:=False)
If Not rFound Is Nothing Then
sAddr = rFound.Address
Do
With rFound
.Offset(0, 1).Value = Right$(.Text, 1)
.Value = Left$(.Text, Len(.Text) - 1)
End With
Set rFound = .FindNext(after:=rFound)
Loop Until rFound.Address = sAddr

End If
End With


In article
,
Robert H wrote:

The following code loops through certain columns and removes the last
character in the data. My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...

How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.

thanks
Robert

Do Until ActiveCell.Value = ""

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
False, SearchFormat:=False).Activate

ActiveCell.Offset(1, 0).Select

Do Until ActiveCell.Value = ""

'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column

Loop

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Limit .find to one pass

Per, the code manipulates the first column correctly but at the
FindNext.Activate line I'm receiving a Runtime Error 424 "Object
Required" error. I tried to fix it but did not make any progress.
thanks
Robert

On Dec 18, 11:57*am, "Per Jessen" wrote:
Hi Robert

I think this should do it:

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
* * lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
* * MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
* * ActiveCell.Offset(1, 0).Select
* * Do Until ActiveCell.Value = ""
* * * * 'Copy the right-most character to the next column
* * * * ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
* * * * 'Cut off the right-most character
* * * * ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
* * * * 'ActiveCell = ActiveCell.Offset(1, 0)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Offset(-r, 1).Select 'move up and to next column
* * FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address

Regards,
Per

"Robert H" skrev i ...

The following code loops through certain columns and removes the last
character in the data. *My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


* * * *Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
* * * * * *xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
* * * * * *False, SearchFormat:=False).Activate


* * * * * ActiveCell.Offset(1, 0).Select


* * * * * * * *Do Until ActiveCell.Value = ""


* * * * * * * * * *'Copy the right-most character to the next column
* * * * * * * * * *ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
* * * * * * * * * *'Cut off the right-most character
* * * * * * * * * *ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
* * * * * * * * * *'ActiveCell = ActiveCell.Offset(1, 0)
* * * * * * * * * *ActiveCell.Offset(1, 0).Select
* * * * * * * *Loop
* * *ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Limit .find to one pass

Per,
the code manipulates the first column correctly but at the
FindNext.Activate line I'm receiving a Runtime Error 424 "Object
Required" error. I tried to fix it but did not make any progress.
thanks
Robert


On Dec 18, 11:57*am, "Per Jessen" wrote:
Hi Robert

I think this should do it:

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
* * lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
* * MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
* * ActiveCell.Offset(1, 0).Select
* * Do Until ActiveCell.Value = ""
* * * * 'Copy the right-most character to the next column
* * * * ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
* * * * 'Cut off the right-most character
* * * * ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
* * * * 'ActiveCell = ActiveCell.Offset(1, 0)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Offset(-r, 1).Select 'move up and to next column
* * FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address

Regards,
Per

"Robert H" skrev i ...



The following code loops through certain columns and removes the last
character in the data. *My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


* * * *Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
* * * * * *xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
* * * * * *False, SearchFormat:=False).Activate


* * * * * ActiveCell.Offset(1, 0).Select


* * * * * * * *Do Until ActiveCell.Value = ""


* * * * * * * * * *'Copy the right-most character to the next column
* * * * * * * * * *ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
* * * * * * * * * *'Cut off the right-most character
* * * * * * * * * *ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
* * * * * * * * * *'ActiveCell = ActiveCell.Offset(1, 0)
* * * * * * * * * *ActiveCell.Offset(1, 0).Select
* * * * * * * *Loop
* * *ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Limit .find to one pass

JE,
Reading my original post, I realize I did not explain the data
structure.
There is a header row with columns of data below it. I need to find
the columns with "LC" in the header cell and then perform the
manipulation in all the data cells in the column (below the header
cell).

You code sugestion code manipulates the cells containing "LC" in the
header row instead of the cells below the header row.
thanks
Robert


On Dec 18, 12:26*pm, JE McGimpsey wrote:
One way:

* * Dim rFound As Range
* * Dim sAddr As String
* * With ActiveSheet.Cells
* * * * Set rFound = .Find( _
* * * * * * * * what:="LC", _
* * * * * * * * after:=.Item(.Rows.Count, .Columns.Count), _
* * * * * * * * LookIn:=xlValues, _
* * * * * * * * Lookat:=xlPart, _
* * * * * * * * searchorder:=xlByColumns, _
* * * * * * * * searchdirection:=xlNext, _
* * * * * * * * MatchCase:=False)
* * * * If Not rFound Is Nothing Then
* * * * * * * * sAddr = rFound.Address
* * * * * * * * Do
* * * * * * * * * * With rFound
* * * * * * * * * * * * .Offset(0, 1).Value = Right$(.Text, 1)
* * * * * * * * * * * * .Value = Left$(.Text, Len(.Text) - 1)
* * * * * * * * * * End With
* * * * * * * * * * Set rFound = .FindNext(after:=rFound)
* * * * * * * * Loop Until rFound.Address = sAddr

* * * * End If
* * End With

In article
,
*Robert H wrote:



The following code loops through certain columns and removes the last
character in the data. *My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


* * * * Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
* * * * * * xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
* * * * * * False, SearchFormat:=False).Activate


* * * * * *ActiveCell.Offset(1, 0).Select


* * * * * * * * Do Until ActiveCell.Value = ""


* * * * * * * * * * 'Copy the right-most character to the next column
* * * * * * * * * * ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
* * * * * * * * * * 'Cut off the right-most character
* * * * * * * * * * ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
* * * * * * * * * * 'ActiveCell = ActiveCell.Offset(1, 0)
* * * * * * * * * * ActiveCell.Offset(1, 0).Select
* * * * * * * * Loop
* * * ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Limit .find to one pass

Robert

Change
FindNext.Activate

to:

Cells.FindNext.Activate


Regards,
Per

On 19 Dec., 14:19, Robert H wrote:
Per,
the code manipulates the first column correctly but at the
FindNext.Activate line I'm receiving a Runtime Error 424 "Object
Required" error. I tried to fix it but did not make any progress.
thanks
Robert

On Dec 18, 11:57*am, "Per Jessen" wrote:



Hi Robert


I think this should do it:


Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
* * lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
* * MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
* * ActiveCell.Offset(1, 0).Select
* * Do Until ActiveCell.Value = ""
* * * * 'Copy the right-most character to the next column
* * * * ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
* * * * 'Cut off the right-most character
* * * * ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
* * * * 'ActiveCell = ActiveCell.Offset(1, 0)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Offset(-r, 1).Select 'move up and to next column
* * FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address


Regards,
Per


"Robert H" skrev i ...


The following code loops through certain columns and removes the last
character in the data. *My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


* * * *Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
* * * * * *xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
* * * * * *False, SearchFormat:=False).Activate


* * * * * ActiveCell.Offset(1, 0).Select


* * * * * * * *Do Until ActiveCell.Value = ""


* * * * * * * * * *'Copy the right-most character to the next column
* * * * * * * * * *ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
* * * * * * * * * *'Cut off the right-most character
* * * * * * * * * *ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
* * * * * * * * * *'ActiveCell = ActiveCell.Offset(1, 0)
* * * * * * * * * *ActiveCell.Offset(1, 0).Select
* * * * * * * *Loop
* * *ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop- Hide quoted text -


- Show quoted text -- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Limit .find to one pass

Per, It works now. I had to make one more modification:
Cells.findnext(ActiveCell).Activate
otherwise it would just go back an work the same column one time and
then exit.
Thanks very much for the help
Robert

Final code:

Sub ConvPMFLTSMoveLCIDtoNextCol()

Dim r As Long
Dim r2
Dim startCell As Range
Dim findnext

r = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row - 1

Range("a1").Select

'Code mosdifications from Per Jessen

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate

Set startCell = ActiveCell

Do
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = ""
'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value,
1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column
Cells.findnext(ActiveCell).Activate
Loop Until ActiveCell.Address = startCell.Address

End Sub

On Dec 19, 9:04*am, Per Jessen wrote:
Robert

Change
FindNext.Activate

to:

Cells.FindNext.Activate

Regards,
Per

On 19 Dec., 14:19, Robert H wrote:



Per,
the code manipulates the first column correctly but at the
FindNext.Activate line I'm receiving a Runtime Error 424 "Object
Required" error. I tried to fix it but did not make any progress.
thanks
Robert


On Dec 18, 11:57*am, "Per Jessen" wrote:


Hi Robert


I think this should do it:


Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
* * lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
* * MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
* * ActiveCell.Offset(1, 0).Select
* * Do Until ActiveCell.Value = ""
* * * * 'Copy the right-most character to the next column
* * * * ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
* * * * 'Cut off the right-most character
* * * * ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
* * * * 'ActiveCell = ActiveCell.Offset(1, 0)
* * * * ActiveCell.Offset(1, 0).Select
* * Loop
* * ActiveCell.Offset(-r, 1).Select 'move up and to next column
* * FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address


Regards,
Per


"Robert H" skrev i ...


The following code loops through certain columns and removes the last
character in the data. *My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


* * * *Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
* * * * * *xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
* * * * * *False, SearchFormat:=False).Activate


* * * * * ActiveCell.Offset(1, 0).Select


* * * * * * * *Do Until ActiveCell.Value = ""


* * * * * * * * * *'Copy the right-most character to the next column
* * * * * * * * * *ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
* * * * * * * * * *'Cut off the right-most character
* * * * * * * * * *ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
* * * * * * * * * *'ActiveCell = ActiveCell.Offset(1, 0)
* * * * * * * * * *ActiveCell.Offset(1, 0).Select
* * * * * * * *Loop
* * *ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop- Hide quoted text -


- Show quoted text -- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -- Hide quoted text -


- Show quoted text -


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Limit .find to one pass

Hi Robert

Thanks for your reply, I'm glad you made it work.

Regards,
Per

"Robert H" skrev i meddelelsen
...
Per, It works now. I had to make one more modification:
Cells.findnext(ActiveCell).Activate
otherwise it would just go back an work the same column one time and
then exit.
Thanks very much for the help
Robert

Final code:

Sub ConvPMFLTSMoveLCIDtoNextCol()

Dim r As Long
Dim r2
Dim startCell As Range
Dim findnext

r = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row - 1

Range("a1").Select

'Code mosdifications from Per Jessen

Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate

Set startCell = ActiveCell

Do
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = ""
'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value,
1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column
Cells.findnext(ActiveCell).Activate
Loop Until ActiveCell.Address = startCell.Address

End Sub

On Dec 19, 9:04 am, Per Jessen wrote:
Robert

Change
FindNext.Activate

to:

Cells.FindNext.Activate

Regards,
Per

On 19 Dec., 14:19, Robert H wrote:



Per,
the code manipulates the first column correctly but at the
FindNext.Activate line I'm receiving a Runtime Error 424 "Object
Required" error. I tried to fix it but did not make any progress.
thanks
Robert


On Dec 18, 11:57 am, "Per Jessen" wrote:


Hi Robert


I think this should do it:


Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues, _
lookat:=xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set Startcell = ActiveCell
Do
ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.Value = ""
'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len(ActiveCell.Value) -
1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column
FindNext.Activate
Loop Until ActiveCell.Address = Startcell.Address


Regards,
Per


"Robert H" skrev i
...


The following code loops through certain columns and removes the
last
character in the data. My data arrangement has changed a little and
now the code continuously loops through the data removing the last
character until there is not data. Its funny to watch but I need to
fix it...


How can I limit the code to make just one pass? Too bad there is not
a
"before" attribute.


thanks
Robert


Do Until ActiveCell.Value = ""


Cells.Find(what:="LC", After:=ActiveCell, LookIn:=xlValues,
lookat:= _
xlPart, searchorder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=
False, SearchFormat:=False).Activate


ActiveCell.Offset(1, 0).Select


Do Until ActiveCell.Value = ""


'Copy the right-most character to the next column
ActiveCell.Offset(0, 1).Value = Right$
(ActiveCell.Value, 1)
'Cut off the right-most character
ActiveCell.Value = Left$(ActiveCell.Value, Len
(ActiveCell.Value) - 1)
'ActiveCell = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-r, 1).Select 'move up and to next column


Loop- Hide quoted text -


- Show quoted text -- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -- Hide quoted text -


- Show quoted text -


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
Conditional Formatting - Getting pass the 3 condition limit Judy Rose Excel Discussion (Misc queries) 11 May 20th 08 07:33 PM
Cells.Find: Why can't I pass a variable? Rick S. Excel Discussion (Misc queries) 10 October 4th 07 07:50 PM
Conditional Formatting - Getting pass the 3 condition limit Hadidas Excel Discussion (Misc queries) 4 July 13th 06 06:45 PM
How do I my find pass word in excel AlShepard Setting up and Configuration of Excel 0 February 6th 06 09:32 PM
Find a Value Pass Row 99 skid Excel Programming 4 June 23rd 05 05:18 AM


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

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

About Us

"It's about Microsoft Excel"