If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > help filling in blank cells

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-08, 10:35
starkmann starkmann is offline
Registered User
 
Join Date: Feb 2007
Posts: 348
help filling in blank cells

I'm not quite sure how to approach this and I hope my question makes sense.
I have attached a file with (totally made up) demo data, that should give you an idea of my issue.

I gave a vendor a flat file representing a database a while back. So they added the flat file to their system. Now their are concerns that they added the data correctly. So we asked for them to give back their version of the file, so we can compare it to the original. Their version has a very annoying format that I need help with.
In the version I sent, each cell was filled in, even if it repeat for 1000 rows. In their version, if a cell repeated down through many rows, they did not bother to fill in the repeats. I need to fill in those blanks so I can do a side by side comparison.

How can I programatically fill in all those blank cells?

The concept I came up was to check if the cell was empty, IfBlank ( grab the value of the above cell). Unfortunately, I found that it gave me a nesting limitation error if I tried to go back more than (approx) 6 cells. I would settle for 10 and manually correct the exceptions.

So I need another idea....

I'm thinking VBA but I do Access VBA and have never really worked in Excel VBA much.

Any help is appreciated including links to how-tos, suggestions, actual code.. etc.

Thanks
Attached Files
File Type: zip DemoData.zip (2.5 KB, 24 views)
Reply With Quote
  #2 (permalink)  
Old 02-07-08, 10:38
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Try this VBA:

Code:
Sub FillIn()
    ' selects current region (contiguous) and fills with value above
    Range("A1").CurrentRegion.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    ' copies values and PasteSpecial values
    Range("A1").CurrentRegion.Value = Range("A1").CurrentRegion.Value
End Sub
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 02-07-08, 10:55
starkmann starkmann is offline
Registered User
 
Join Date: Feb 2007
Posts: 348
Oh ho, awesome. I owe you.

Already run and it works like a charm
Reply With Quote
  #4 (permalink)  
Old 02-07-08, 11:06
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Great. I found it very helpful over the years. I keep it in the Personal.xls file for frequent use.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On