+ Reply to Thread
Results 1 to 3 of 3

Macro to shift entire row to right based on search term

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2013
    Location
    NEW YORK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Macro to shift entire row to right based on search term

    Hi,

    I have an excel with following sample data :-

    Formula: copy to clipboard
    FIRST_NAME    LAST_NAME   DOB
    ANDRE SYMMONDS 12/11/1978
    JAY SIMMONS 3/4/1988
    FIRST_NAME LAST_NAME DOB
    ROBBIN WILLIAMS 5/10/1954
    FIRST_NAME LAST_NAME DOB
    SANDRA LIN 12/5/1976
    JOHN SMITH 4/3/1982



    my requirement is to shift all header rows(FIRST_NAME LAST_NAME DOB) to 3 places to right.
    so only headers will be shifted to right rest data fields will remain in their positions.

    I am using excel 2010

    Thanks,
    Puneet

  2. #2
    Registered User
    Join Date
    10-22-2013
    Location
    NEW YORK
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Macro to shift entire row to right based on search term

    Probably i was not clear enough

    I just want a vba code using which i can shift rows containing word "first_name" to right side.
    so the code should look for this term in first column and whereever it finds this term, entire row should shift to right side

    Please let me know if i am not clear

  3. #3
    Forum Contributor
    Join Date
    03-28-2013
    Location
    *
    MS-Off Ver
    Excel 2010
    Posts
    226

    Re: Macro to shift entire row to right based on search term

    I dont Understand Exactly What you said, but maybe this below code please try let us this is what you looking for.

    Sub myTest()
    Dim i As Integer
    i = 1
      Do While Range("a" & i) <> ""
        If Left(Range("a" & i).Value, 1) = "F" Then
            Range("a" & i).Resize(1, 3).Copy Range("a" & i).Offset(0, 3)
        End If
        i = i + 1
      Loop
    End Sub
    Last edited by venkatpvc; 10-23-2013 at 05:31 PM. Reason: change some code
    Give Feedback and Click(*)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to search column for blank cells & shift entire row right
    By BirdS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2014, 08:07 AM
  2. Macro to select data based in a search term and populate a table
    By Gabriel Valck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2012, 05:57 PM
  3. Replies: 3
    Last Post: 11-06-2012, 11:26 AM
  4. Replies: 0
    Last Post: 02-14-2012, 12:34 PM
  5. Search for term in multiple cells
    By Snowtoad in forum Excel General
    Replies: 1
    Last Post: 08-13-2010, 02:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1