Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Make a loop to Find a value then move a row of cells

I have imported a report into excel.
In column A I need to look for the word "set value". When I find "set
value" in column A I need to move a row of cell that start in column C and
are located one row below where where the word "set value" is located to the
same row that "Set value" is located. I need to do this for the entire
report.
  #2   Report Post  
Posted to microsoft.public.excel.programming
ADG ADG is offline
external usenet poster
 
Posts: 76
Default Make a loop to Find a value then move a row of cells

Hi Bill

The below moves data in columns C to E up one line, change 5 for the number
of the column you need to end with .

Public Sub MoveStuff()
Dim lngLastRow, lngRow As Long
With ActiveSheet
lngLastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
For lngRow = 1 To lngLastRow
If Left(.Cells(lngRow, 1).Value, 9) = "Set value" Then
.Range(.Cells(lngRow, 3), .Cells(lngRow, 5)).Value =
..Range(.Cells(lngRow + 1, 3), .Cells(lngRow + 1, 5)).Value
.Range(.Cells(lngRow + 1, 3), .Cells(lngRow + 1, 5)).Value = Null
End If
Next
End With
End Sub
--
Tony Green


"Bill F" wrote:

I have imported a report into excel.
In column A I need to look for the word "set value". When I find "set
value" in column A I need to move a row of cell that start in column C and
are located one row below where where the word "set value" is located to the
same row that "Set value" is located. I need to do this for the entire
report.

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
How do I make cells not move in a worksheet VJ_xsell Excel Worksheet Functions 0 February 25th 10 06:27 PM
How can I make the cursor move down 8 cells each time I press ente Cadnys Kisses Setting up and Configuration of Excel 2 August 17th 07 08:08 PM
doubleclick to make cells move to another cell rayjay Excel Programming 1 March 6th 06 12:47 AM
Query results make entire sheet's cells move chuckiej[_3_] Excel Programming 2 May 18th 04 03:14 PM
Problem with cells.Find within a loop jowatkins Excel Programming 4 December 9th 03 01:39 PM


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