Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a row of cells and I want to fill the cell in column D if
column D is empty. I want to fill it with the information in the same cell but then column B. All cells are texts. I've tried it, but I couldn't manage it because I want to fill the cell which was empty first. Does somebody have a suggestion for a VBA code? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub copycolb()
'use column B last row because lastt row in D may be empty Lastrow = Cells(Rows.Count, "B").End(xlUp).Row Set ColDRange = Range(Cells(1, "D"), Cells(Lastrow, "D")) For Each cell In ColDRange If IsEmpty(cell.Value) Then cell.Value = cell. _ Offset(Rowoffset:=0, columnoffset:=-2).Value End If Next cell End Sub "bartman1980" wrote: I have a row of cells and I want to fill the cell in column D if column D is empty. I want to fill it with the information in the same cell but then column B. All cells are texts. I've tried it, but I couldn't manage it because I want to fill the cell which was empty first. Does somebody have a suggestion for a VBA code? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 13 aug, 13:04, Joel wrote:
Sub copycolb() 'use column B last row because lastt row in D may be empty Lastrow = Cells(Rows.Count, "B").End(xlUp).Row Set ColDRange = Range(Cells(1, "D"), Cells(Lastrow, "D")) For Each cell In ColDRange If IsEmpty(cell.Value) Then cell.Value = cell. _ Offset(Rowoffset:=0, columnoffset:=-2).Value End If Next cell End Sub "bartman1980" wrote: I have a row of cells and I want to fill the cell in column D if column D is empty. I want to fill it with the information in the same cell but then column B. All cells are texts. I've tried it, but I couldn't manage it because I want to fill the cell which was empty first. Does somebody have a suggestion for a VBA code?- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - Thank you very much, this works! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Go To the next empty cell in Column A | Excel Worksheet Functions | |||
fill in empty cells with previous entry in column | Excel Discussion (Misc queries) | |||
Macro Request: Fill in empty cells with previous Filled cell in column | Excel Worksheet Functions | |||
Hiding column if cell in previous column is empty-revised | Excel Programming | |||
Fill handle - new column using a column and one cell | Excel Discussion (Misc queries) |