find and move cell

Posted on 2014-03-28
Last Modified: 2014-03-31
Can an expert help me out with this please.

This is a CSV file with the data in Column A. When I find Grp1 I want to move that row to column B

Grp1       5860.0000           0.00           0.00       0.00                         0.00         666.90

So if
is in A3

and Grp1       5860.0000           0.00           0.00       0.00                         0.00         666.90
is in A4 , move
Grp1       5860.0000           0.00           0.00       0.00                         0.00         666.90

to B3

Question by:Jagwarman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 12

Accepted Solution

Harry Lee earned 500 total points
ID: 39962056

You can use this vba to do it.

Sub FormatCSVReportv1()
Dim I As Long, LastRW As Long

LastRW = Cells(Rows.Count, 1).End(xlUp).Row
For I = 1 To LastRW
    If Cells(I, 1) Like "*Grp1*" Then
        Cells(I - 1, 2) = Cells(I, 1)
    End If

For I = LastRW To 1 Step -1
    If Cells(I, 1) Like "*Grp1*" Then
        Cells(I, 1).EntireRow.Delete Shift = UP
    End If
End Sub

Open in new window

LVL 45

Expert Comment

ID: 39962116
please post an example workbook with the before and after state of row data you are describing.

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question