#1
|
|||
|
|||
How can I fill the below emty cells with above cell data?
Hi,
How can I fill below cells which are blank (Empty Cells) with the above cell data? Like in the following example: Column: A Cell 1: 54001 Cell 2: Cell 3: 54003 Cell 4: Cell 5: Cell 6: Cell 7: 56321 Cell 8: Cell 9: -------------------------The reuslt should be like the following in RED: Cell 1: 54001 Cell 2: 54001 Cell 3: 54003 Cell 4: 54003 Cell 5: 54003 Cell 6: 54003 Cell 7: 56321 Cell 8: 56321 Cell 9: 56321 Please help me with function/code. Because I need to modify hundreds of records on several sheets. It is very hard to do it manually. Thanks. |
#2
|
|||
|
|||
Hi
Paste this code into a module in your workbook. It will deal with 1000 rows in Column A of your worksheet. Let me know if you need to cover more columns. Sub CellCheckForBlank() ' ' Check for Blank Cells and populate with value above ' For Count = 1 To 1000 myVal = Range("A" & Count) Range("A" & Count + 1).Select If Range("A" & Count + 1) = "" Then Range("A" & Count + 1) = myVal End If Next Count End Sub Tony (OTPM) |
#3
|
|||
|
|||
Quote:
Please help me to figure it out. Regards. |
#4
|
|||
|
|||
Hi
I tested it fully and it worked fine. Can you post a sample of your spreadsheet and I will attempt to provide a fix. Kind regards Tony(OTPM) |
#5
|
|||
|
|||
Thanks again. The following is the Test Excel work book attached for review.
|
#6
|
|||
|
|||
Hi
I tested the macro it it seemed to work fine for me. If I understand you correctly it should do the following: 1. As Cell A6 is blank it should copy the contents of Cell A5 into Cell A6. 2. As Cell A11 and A12 are blank then copy the contents of Cell A10 into Cells A11 and A12. and so on.................. The macro will run for 1000 lines. So Cell A30 will be copied to Cells A31 through A1000. If this is not what you want then please explain what you expect to happen and I will see what I can do. Tony(OTPM) |
#7
|
|||
|
|||
Quote:
CopyDataToCell-5 CopyDataToCell-6 CopyDataToCell-10 CopyDataToCell-11 CopyDataToCell-12 Actually it should copy: CopyDataToCell-5 CopyDataToCell-5 CopyDataToCell-10 CopyDataToCell-10 CopyDataToCell-10 Where I am doing wrong in executing the function. Please help. Thanks. |
#8
|
|||
|
|||
Hi
Now I understand why it did not run for you. You need to select the macro and choose run. It will then automatically fill the blank cells down to row 1000. Hope this helps. Tony(OTPM) |
#9
|
|||
|
|||
Quote:
Regards. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move data from 1 cell to another cell | Catalin.B | Excel | 1 | 06-25-2011 12:51 PM |
How to fill a cell with random numbers to do calculations? | zanat0s | Excel | 1 | 06-13-2011 10:33 AM |
How to combine different cells data in one cell? | Learner7 | Excel | 1 | 07-28-2010 12:07 PM |
How can I fill cell color starting from Cell D5 using Conditional formatting instead | Learner7 | Excel | 0 | 07-08-2010 05:50 AM |
Automatically entering/fill data in cells in Excel 2003 | dipdog | Excel | 0 | 08-17-2006 08:37 AM |