+ Reply to Thread
Results 1 to 4 of 4

Move cells to the left

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-29-2008
    Location
    usa
    MS-Off Ver
    EXCEL 2010
    Posts
    116

    Move cells to the left

    Move cell contents to the left side in columns D, E, F, G. (Phone numbers)
    So let’s say that a cell on column D is empty and but the cell to the right E has a phone number i would like to have the number on the cell of column D
    So basically within the columns D, E, F, and G. i want all the phone number to the left without affecting any other columns.
    Any help with this I appreciated
    I also attach a sample spreadsheet for better understanding Thankyou
    Attached Files Attached Files
    Last edited by martinez_pedro; 06-01-2011 at 08:52 AM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Move cells to the left

    Cut columns D:G and paste them into columns M:P.
    With columns M:P still selected press F5 > Special > Blanks > OK.
    Right click > Delete > Shift Cells Left
    Cut columns M:P and insert them back into D:G again.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Move cells to the left

    A macro way.

    Option Explicit
    
    Sub ShiftPhoneNumber()
    Dim lastrow As Long
    Dim icell As Long
    
    lastrow = Range("A" & Rows.Count).End(xlUp).Row
    
    Application.ScreenUpdating = False
    For icell = 2 To lastrow
        If IsEmpty(Range("D" & icell)) Then
            If IsEmpty(Range("E" & icell)) Then
                If IsEmpty(Range("F" & icell)) Then
                    Range("G" & icell).Cut Destination:=Range("D" & icell)
                Else
                    Range("F" & icell, "G" & icell).Cut Destination:=Range("D" & icell)
                End If
            Else
                Range("E" & icell, "G" & icell).Cut Destination:=Range("D" & icell)
            End If
        Else
        End If
    Next icell
    Application.ScreenUpdating = True
    Application.CutCopyMode = False
    
    End Sub

  4. #4
    Forum Contributor
    Join Date
    09-29-2008
    Location
    usa
    MS-Off Ver
    EXCEL 2010
    Posts
    116

    Re: Move cells to the left

    thank you very much guys appreciated the help i tried both ways and worked perfectly

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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