Fill Blank Cells To Left

eran3185

Board Regular
Joined
Apr 28, 2007
Messages
142
Hi

I want to know if there is a way to to fill empty cells with value left.
i have this example:

e d c b a
1 Y X
2 Y X

I want to get this:
e d c b a
1 Y Y Y X X
2 Y X X
 
Hi peter.
Tnx again, but I have 1 more question/
Is there a way to run this code from left to right ?

Tnx
eran
Please explain exactly what you mean.

1. Your original headings in post #1 suggests that you may have "Show sheet right-to-left" turned on in your options. Is that the case?

2. Please give a small example of what you have, including showing where it is and what result you want.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Sorry
I made this short example

Before:
xxx 2017/02 2017/03 2017/04 2017/05 2017/06 2017/07 2017/08 2017/09
A X X
B X
C Y Y
D X X
E X
F Y Y
G Y X
H X


After:
xxx 2017/02 2017/03 2017/04 2017/05 2017/06 2017/07 2017/08 2017/09
A X X X
B X X X
C Y Y Y
D X X X
E X X X
F Y Y Y
G Y Y X X
H X X
 
Upvote 0
Firstly, which post is easier to tell what columns and rows the data is in, this one or post #12 ? ;)
You really can't expect people to keep trying to figure that out from such postings. :(
See my signature block below for more help on that.

If the data starts like this ..


Book1
ABCDEFGHI
1xxx1/02/20171/03/20171/04/20171/05/20171/06/20171/07/20171/08/20171/09/2017
2AXX
3BX
4CYY
5DXX
6EX
7FYY
8GYX
9HX
Fill blanks


.. then this code ..

Code:
Sub FillBlanksRight()
  Application.ScreenUpdating = False
  With ActiveSheet.UsedRange.Offset(1, 1)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=IF(COUNTA(RC1:RC[-1])>1,RC[-1],"""")"
    .Value = .Value
  End With
  Application.ScreenUpdating = True
End Sub

.. produced this outcome.


Book1
ABCDEFGHI
1xxx1/02/20171/03/20171/04/20171/05/20171/06/20171/07/20171/08/20171/09/2017
2AXXX
3BXXX
4CYYY
5DXXX
6EXXX
7FYYY
8GYYXX
9HXX
Fill blanks
 
Upvote 0

Forum statistics

Threads
1,223,771
Messages
6,174,441
Members
452,564
Latest member
crangelag

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