Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to fill in the blank! not drag but fill in blank cells with...

Status
Not open for further replies.

rmyslik

IS-IT--Management
Aug 2, 2001
33
US
I need to find blank cells and fill them in with the data of the above cell.
For example a1=215 a2=365 a3="" a4=523 a5="" I want to automatically find the blank cells and fill them in. SO a3 would =365 and a5=523. Thanks for any assistance.
 
The only way you are going to be able to do this is with a macro:

Sub fillblanks()
Dim cc As Object
For Each cc In Selection
If cc.Value = "" Then
cc.Value = cc.offest(-1, 0).Value
End If
Next cc
End Sub

To use the macro, fisrt go to Tools, Macro, Visual Basic Editor. Go to Insert, Module; and copy the Macro in the right hand pane.

In your Excel spreadsheet highlight all the cells in the column for which you want fill. Go to Tools, Macro, Macros and run the fillblanks macro
 
2 ways - either code or a formula in a new column and then copy/paste values
I will not post the former unless you ask for it as it is more complex. To do the latter, starting in B2, enter

=IF(A2="",A1,A2)

Fill this all the way down to the bottom of your dataset
select the whole range of cells in colB and copy
Goto Edit>PasteSpecial and select "Values"
Paste from A2
delete column B

HTH Rgds
~Geoff~
 
Thank you! The first thread said "this function is not supported" so I inserted a column and added the if(a2="",a2=a1) and dragged it all the way down! Then simply used that column! Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top