Thread
:
Copy Row Above, with a Twist Q
View Single Post
#
2
Posted to microsoft.public.excel.programming
Claus Busch
external usenet poster
Posts: 3,872
Copy Row Above, with a Twist Q
Hi,
Am Wed, 4 Jan 2017 23:52:19 -0800 (PST) schrieb
:
I have several Blank rows above each is a row of data (covering columns A-D), what I want to do is populate each blank row with the following:-
Col A - Copy the Text from Row Above
Col B - Insert fixed Text "ABC"
Col C - I wish to remain blank
Col D - Copy the value that is in Col C in Row above to this column
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"
rngC.Offset(, 3) = rngC.Offset(-1, 2)
Next
End With
End Sub
Regards
Claus B.
--
Windows10
Office 2016
Reply With Quote
Claus Busch
View Public Profile
Find all posts by Claus Busch