Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Anthony
Try this Sub findBlanksInE() 'Assign a variable to hold last row number Dim lLastRow As Long 'Assign a variable to hold the range object Dim myCell As Range 'Find the last row in column E by going to bottom/up lLastRow = Range("E65536").End(xlUp).Row 'iterate each cell (myCell) in the defined range For Each myCell In Range("E1:E" & lLastRow) 'If the cell is blank "" If myCell = "" Then 'If the cell, offset one column Left(D) is not blank If myCell.Offset(0, -1).Value < "" Then myCell.Value = myCell.Offset(0, -1).Value Else 'If cell, offset 1 column left IS blank, use two columns left (C) myCell.Value = myCell.Offset(0, -2).Value End If End If 'Loop to next cell Next myCell End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "anthony" wrote in message ... i need a macro to check all blank cells in column E then move what is in column D in the same row into that cell if the coresponding cell in column D is blank tehn we use wahtever value is in the C column. please make it simple with tons of comments as am new to macros and would like to write my own macros. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using a Macro to paste into Blank Cells | Excel Worksheet Functions | |||
Generating truly blank cells | Excel Worksheet Functions | |||
enter numbers in blank cells | Excel Worksheet Functions | |||
Counting blank and filled cells within a range. | Excel Discussion (Misc queries) | |||
Macro to omit blank cells needed | Excel Worksheet Functions |