Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill down empty cells at every change in value Rose Excel Worksheet Functions 4 March 24th 09 03:03 PM
Find empty cells, fill with text from cell above Marketer Excel Worksheet Functions 1 August 27th 07 10:35 PM
Excel - Fill empty cells Yendorian Excel Worksheet Functions 3 July 23rd 07 09:34 AM
I need to fill only empty cells in a database with a symbol. SMC Excel Discussion (Misc queries) 2 April 24th 07 04:28 PM
Fill-in empty cells from SAP report Ilieski Excel Worksheet Functions 3 September 14th 05 12:55 PM


All times are GMT +1. The time now is 07:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"