Solved

VBA - EXCEL CHALLENGING QUESTION!!

Posted on 2004-09-27
3
277 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
Comment Utility
   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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hasOne  challenge 59 89
scoreUp challenge 14 48
File.WriteAllLines problem at random C# ASP.NET 6 53
strCopies  challenge 17 73
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now