Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA - EXCEL CHALLENGING QUESTION!!

Posted on 2004-09-27
3
Medium Priority
?
317 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
1 Comment
 
LVL 11

Accepted Solution

by:
Louis01 earned 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Introduction to Processes
Starting up a Project

783 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