Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
charting missing data (empty cells bug) | Charts and Charting in Excel | |||
how to return non empty cells over several columns | Excel Discussion (Misc queries) | |||
Delete row if 3 columns have empty cells in a row | Excel Programming | |||
Charting with missing data or empty strings from vlookup() | Charts and Charting in Excel | |||
Filling in empty cells in columns | Excel Discussion (Misc queries) |