Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBA - EXCEL CHALLENGING QUESTION!!

Posted on 2004-09-27
3
Medium Priority
?
313 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
[X]
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
3 Comments
 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

721 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