LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Search for value move to next column code not working

Please assist.

I would like the code to search column a for any instance of total remove it
and place in the next column b

Dim lastrow As Long
Dim strTotal As String
Dim Rng As Range

Application.ScreenUpdating = False
strTotal = "total"

With ActiveSheet
lastrow = .Range("A1").SpecialCells(xlCellTypeLastCell).Row

End With

Set Rng = Range("a:a").Find(What:=strTotal, _
After:=Range("a" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

For I = lastrow To 2 Step -1
If Cells(I, 1).Value = Rng Then
Cells(I, 2).Value = Cells(I, 1).Value


End If
Next I


Application.ScreenUpdating = True


Thanks
 
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
move to the cell on the right, my code not working pls help [email protected] Excel Programming 5 April 17th 07 03:48 AM
How do I move data based on a conditional column search? bbaek Excel Programming 1 May 27th 05 04:17 PM
Search column and move text formula tommy Excel Discussion (Misc queries) 0 February 8th 05 06:55 PM
Column find code not working correctly Todd Huttenstine Excel Programming 2 November 16th 04 09:18 PM
Move a column in one line of code MacroMan Excel Programming 2 July 31st 03 11:25 AM


All times are GMT +1. The time now is 04:07 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"