LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default missing data in columns[empty cells]

i have one idea to solve the problem but unable to program it in vba
hope sumbody wud help me out

the idea is

say we have values in column A & column B

for each r in my range
(columnA) [columnB]

if r.activecell.value <"" and r.offset(0,1).value = "" then

call Sub FillColBlanks

else

move to next row and make it as active cell

Sub FillColBlanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim rng As Range
Dim LastRow As Long
Dim col As Long

Set wks = ActiveSheet
With wks
col = ActiveCell.Column
'or
'col = .range("b1").column

Set rng = .UsedRange 'try to reset the lastcell
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Nothing
On Error Resume Next
Set rng = .Range(.Cells(2, col), .Cells(LastRow, col)) _
.Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "No blanks found"
Exit Sub
Else
rng.FormulaR1C1 = "=R[-1]C"
End If

'replace formulas with values
With .Cells(1, col).EntireColumn
.Value = .Value
End With

End With

End Sub


 
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
charting missing data (empty cells bug) Kazim Mammadhuseyn Charts and Charting in Excel 2 October 27th 09 08:51 AM
how to return non empty cells over several columns iago Excel Discussion (Misc queries) 4 June 11th 07 03:31 PM
Delete row if 3 columns have empty cells in a row Les Stout[_2_] Excel Programming 7 April 18th 07 06:30 PM
Charting with missing data or empty strings from vlookup() MJS Charts and Charting in Excel 2 February 23rd 07 07:16 AM
Filling in empty cells in columns koba Excel Discussion (Misc queries) 2 November 8th 05 10:03 PM


All times are GMT +1. The time now is 09:12 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"