Solved

VBA - EXCEL CHALLENGING QUESTION!!

Posted on 2004-09-27
3
284 Views
Last Modified: 2010-04-17
I need help to write a vba script to search down one column for rows that starts with "GR" within the cell.  Some of the rows could be blank so the search can not end upon reaching the first blank cell.  Once the search finds a cell starting with "GR" the cell containing GR and the 3 cells on the right of this cell must be moved to (offset) to the same row but to column AA.
Note that I must be able to run this for many columns (not only one), but all of the results irrrespective of where the GR cell  is (that is at which column that is), must conclude in column AA

Thanks in advance.
0
Comment
Question by:fzd
3 Comments
 
LVL 11

Accepted Solution

by:
Louis01 earned 125 total points
ID: 12166892
   Dim i As Long
    Dim ws As Worksheet
   
    Set ws = Worksheets("Sheet1")
   
    For i = 1 To ws.UsedRange.Rows.Count
        If Left(ws.Cells(i, 1), 2) = "GR" Then
            ws.Range(ws.Cells(i, 1), Sheet1.Cells(i, 4)).Cut Destination:=Sheet1.Cells(i, 27)
        End If
    Next i
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

809 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