Dragging data over without overwriting existing data.

DannyBidz

New Member
Joined
May 7, 2014
Messages
19
Hi All,

Please see the below example. Is there a way I can select the data in col. B and either cut / paste or drag over into col. A without overwriting the existing data in Col. A? So as to essentially just fill the gaps.

Dragging the Col. B items over one at a time will be rather time consuming for the list I have on my actual sheet.

[TABLE="class: grid, width: 200"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[/TR]
[TR]
[TD]Colour[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Red[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Green[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Brown[/TD]
[/TR]
[TR]
[TD]Purple[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Silver[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Orange[/TD]
[/TR]
[TR]
[TD]Pink[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thanks for the help!

Cheers,

Dan.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Will col A always be blank if there is a value in col B?
 
Upvote 0
If the blanks and the value always line up like in your example this should work.



Code:
Sub fillblank()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For x = 2 To lr
    If Cells(x, "A") = "" Then Cells(x, "A") = Cells(x, "B")
Next x
Range("B2:B" & lr).ClearContents

End Sub
 
Upvote 0
If the answer to post#2 is yes, another option is
Code:
Sub DannyBidz()
   Range("A:A").SpecialCells(xlBlanks).Delete xlToLeft
End Sub
 
Upvote 0
If Blanks in Col A & values in col B won't always line up, try
Code:
Sub DannyBidz2()
   With Range("B:B").SpecialCells(xlConstants)
      .Copy Range("A" & Rows.Count).End(xlUp).Offset(1)
      Range("A:A").SpecialCells(xlBlanks).Delete xlUp
      .ClearContents
   End With
End Sub
 
Upvote 0
Hi folks, sorry it's took a while respond, and yes the values in col A will always be blank when there is a value in col B, so I shall try the options suggested.

Thank you so much for the help :)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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