T
tbmarlie
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
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