Unique cell value should gets copy to below cell

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hello, I am looking for macro to copy and paste the unique values in one cell to below cells till next new value found. Plz help on this Thank you

Here is the example:

Column E
ST00001

BTA1
ST00002

ST00003
BTA2

ST00004

End......

Output Should be.
ST00001
ST00001
BTA1
ST00002
ST00002
ST00003
BTA2
BTA2
ST00004
ST00004
End......
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Does it have to be a macro? You can get a similar result by doing this:
1. Select the entire column
2. Press F5
3. The "Go To" dialog box will appear. Click the "Special..." button in the lower left corner
4. Select the radio button for "Blanks" and click "OK"
5. In the first cell, type the formula to make that cell equal to the cell above it
6. Press the keys CTRL and ENTER at the same time

If the cells aren't blank, you might run into some problems, but this will save you from trying to write a macro for it.
 
Upvote 0
Thanks for your reply....I have tried the way you explained in the below...however I did not get the results...could you please suggest any alternative way....Thanks again
 
Upvote 0
What was the problem you encountered?

Sometimes, when I use this technique, the cells are not truly blank. The result is that none of the cells are selected because Excel thinks there is something in them. To remedy this problem, I select the data I want and run this code:
Code:
Sub RemoveDuffs()
    Dim LastRow As Long, LastCol As Integer, cell As Range
     
    LastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
    LastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column
     
    For Each cell In Range(Cells(1, 1), Cells(LastRow, LastCol))
        If IsEmpty(cell) = False And Len(cell) = 0 Then cell.Clear
    Next cell
     
End Sub

Then I am able to re-try the previously mentioned technique, and it works just fine.
 
Upvote 0

Forum statistics

Threads
1,215,793
Messages
6,126,937
Members
449,349
Latest member
Omer Lutfu Neziroglu

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