Shifting Cells

jislandhopper

Board Regular
Joined
Jul 23, 2013
Messages
92
Hi,
I’m using Excel 2007 and I have some data which has been imported from an old system and the data copies over all in one cell. I can separate the data into 3 columns by using the text to columns, which helps because an option is to make a break after every space. But because the data I’m copying isn’t complete the data is not in the right columns, I’ve tried to sort and just shift them over but it can’t be performed over multiple selections.
Is it possible to make an argument if column C is blank move cell A & B across one cell? Below is an example of the data before, and what I would like it to see.

Whats happening after using text to columns
column A
column B
column C
CUSTOMER REF
OUR REF
SERVIVCE
REF1
70445
LON1
REF2
70446
LON1
70447
BIR1
70448
BIR2
What I would like it to look like
column A
column B
column C
CUSTOMER REF
OUR REF
SERVIVCE
REF1
70445
LON1
REF2
70446
LON1
70447
BIR1
70448
BIR2

<tbody>
</tbody>


I would really appreciate any assistance
Thanks,
Jason.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Jason,

To affect the cell position you'll need to use VBA. Try the following VBA code.

Code:
Sub test()
Dim lr As Long, Rng
With ActiveSheet.UsedRange
    lr = .Cells(.Rows.Count, 1).Row
End With
On Error GoTo safeExit
For Each Rng In Range("C1:C" & lr).SpecialCells(xlCellTypeBlanks).Areas
    Rng.Offset(0, -2).Insert shift:=xlShiftToRight
Next
safeExit: Exit Sub
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,403
Messages
6,119,309
Members
448,886
Latest member
GBCTeacher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top