Forum Discussion

Excel380's avatar
Excel380
Copper Contributor
Apr 15, 2022

Kindly help

I exported a file in Excel that shows two columns with min income and Max income. Now when I exported the file, Excel made three columns in total where I see majorly figures are in 2 columns but a few figures are shifted to 1 colum extra.

 

An example below. 

 

A.    B      C 

200 300 

100 400 

        300 200

340 559

        600 100

 

Now I need to know with a large data how I can place these figures back to column A and B ?

 

 

3 Replies

  • Excel380 

    Sub shift()
    
    Dim i As Integer
    Dim lngzeilemax As Integer
    
    lngzeilemax = Cells(Rows.Count, 2).End(xlUp).Row
    
    For i = 1 To lngzeilemax
    
    If Cells(i, 1).Value = "" Then
    Cells(i, 1).Delete shift:=xlToLeft
    Else
    End If
    
    Next i
    
    End Sub

    Maybe with these lines of code. Click the button in cell E3 in the attached file to start the macro.

Resources