View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Copy Row Above, with a Twist Q

Hi,

Am Thu, 5 Jan 2017 00:35:56 -0800 (PST) schrieb :

Re Col D - if Col C is blank i.e. has no value (in the row above), then what the Value is in Col D should be copied to Col C, if Col C is not blank, then your original code


I hope I understood your problem.
Try:

Sub Test()
Dim LRow As Long
Dim myRng As Range, rngC As Range

With ActiveSheet
LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
Set myRng = .Range("A2:A" & LRow)
For Each rngC In myRng.SpecialCells(xlCellTypeBlanks)
rngC = rngC.Offset(-1, 0)
rngC.Offset(, 1) = "ABC"
If Len(rngC.Offset(-1, 2)) = 0 Then
rngC.Offset(, 2) = rngC.Offset(-1, 3)
Else
rngC.Offset(, 3) = rngC.Offset(-1, 2)
End If
Next
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016