LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default While-Wend loop to fill in nulls

I'm trying to find any non-null cells in column f and then fill in any
null cell(s) below it with the value of that particular non-null cell
until it gets to the next non-null cell in column f. And, then repeat
this process for every non-null cell it until it gets to the end of my
overall data. I've created the code shown below, but it only partially
fills in the data; it only fills in one null cell below the non-null
cell. I'm sure I'm missing something obvious.

Dim h As Long
For h = Cells(1, "g").End(xlDown).Row To 1 Step -1
If Cells(h, "f") < "" Then
While Cells(h + 1, "f") = "" And Cells(h + 1, "g") < ""
Cells(h + 1, "f") = Cells(h, "f")
Wend
End If
Next h

Some sample data is as follows:
column f column g
xxx-xx-xxxx INCENTIVE PAYMENTS YTD
EXCLUDED FROM FICA-HI YTD
yyy-yy-yyyy INCENTIVE PAYMENTS YTD
EXCLUDED FROM FICA-HI YTD
zzz-zz-zzzz SOLTAX EARNINGS NO 3
TAXABLE FICA-SS YTD
TAXABLE FICA-HI YTD
TAX FEDERAL WITHHOLDING
TAX FICA-SS
TAX FICA-HI
SOLTAX DEDUCTION NO 1
999-99-999 SUPPL PAY

 
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
WEND in VBA Dave F Excel Discussion (Misc queries) 9 April 4th 23 10:37 AM
Loop and fill Question ram Excel Programming 5 October 21st 05 06:28 PM
Setting up a simple loop to fill labels? justchris[_2_] Excel Programming 5 August 23rd 05 12:50 PM
While ... Wend Andrzej Excel Programming 7 June 24th 05 08:03 PM
help on insert rows and fill down loop until end mark mcgrath Excel Programming 1 January 16th 04 01:50 AM


All times are GMT +1. The time now is 08:20 AM.

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

About Us

"It's about Microsoft Excel"