View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Victor Delta[_2_] Victor Delta[_2_] is offline
external usenet poster
 
Posts: 199
Default Excel macro - VBA code query

In article , says...

Hi,

Am Sun, 27 Mar 2016 10:09:07 +0100 schrieb Victor Delta:

Thanks. So perhaps that's where I was going wrong...? What I tried to
write was a macro that would go up column G, calling the Copy_Title
macro every time it got to a cell where the cell and the one above were
blank. (This is exactly what I do manually at present!)


you don't have to copy. You can refer correctly to your Author. Modify
in the code "your title" to the cell you wanted to copy:

Sub Test()
Dim LastRow As Long, i As Long

LastRow = Cells(Rows.Count, 7).End(xlUp).Row
For i = LastRow To 2 Step -1
If IsEmpty(Cells(i, 7)) And IsEmpty(Cells(i - 1, 7)) Then
Cells(i, 7) = "your title"
End If
Next
End Sub


Regards
Claus B.


Claus

Very many thanks.

V