Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill empty cells
I am running reports of a DB. Problem is that I have information that is left blank, if the information in question has multiple entries. For example: Store Name Store Group Product X ABC H Blank (X) Blank (ABC) J Y ABC H Z ABC H Blank (Z) Blank (ABC) J Blank (Z) Blank (ABC) I So the blank cell should have contained the same info as the cell directly above it. Any help on VBA to achieve this? -- Thiem ------------------------------------------------------------------------ Thiem's Profile: http://www.excelforum.com/member.php...o&userid=27474 View this thread: http://www.excelforum.com/showthread...hreadid=499318 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill empty cells
Thiem,
Try this Sub insert_data() ' assume headings on row 1 and data starts on row 2 Dim ws As Worksheet Dim r As Long Set ws = ActiveSheet r = 2 Do While (ws.Range("C" & r) < "") If ws.Range("A" & r) = "" Then ws.Range("A" & r) = ws.Range("A" & r - 1) End If If ws.Range("B" & r) = "" Then ws.Range("B" & r) = ws.Range("B" & r - 1) End If If r = 65536 Then Exit Do r = r + 1 Loop Set ws = Nothing End Sub -- HTHs Martin "Thiem" wrote: I am running reports of a DB. Problem is that I have information that is left blank, if the information in question has multiple entries. For example: Store Name Store Group Product X ABC H Blank (X) Blank (ABC) J Y ABC H Z ABC H Blank (Z) Blank (ABC) J Blank (Z) Blank (ABC) I So the blank cell should have contained the same info as the cell directly above it. Any help on VBA to achieve this? -- Thiem ------------------------------------------------------------------------ Thiem's Profile: http://www.excelforum.com/member.php...o&userid=27474 View this thread: http://www.excelforum.com/showthread...hreadid=499318 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fill down empty cells at every change in value | Excel Worksheet Functions | |||
Find empty cells, fill with text from cell above | Excel Worksheet Functions | |||
Excel - Fill empty cells | Excel Worksheet Functions | |||
I need to fill only empty cells in a database with a symbol. | Excel Discussion (Misc queries) | |||
Fill-in empty cells from SAP report | Excel Worksheet Functions |