Help Please Cut/Paste Macro for DVD Subtitles

  • Thread starter Thread starter Pete McCosh
  • Start date Start date
P

Pete McCosh

Pock,

this will work if the cells with no time are actually
blank, rather than having spaces in them or something.
Watch out for the text wrap after the "If" statement. I've
included a few lines at the end which will scroll back up
and delete the entries with no time against them: if you
want to use this just remove the comment marks, if not
leave it as it is.

Cheers, Pete

Sub MatchTitles()

Dim LastRow as integer, LastTime as integer, x as integer

LastRow = ActiveSheet.UsedRange.Rows.Count
LastTime = 2

For x = 2 to LastRow
If Cells(x,1).value & Cells(x,2).value = "" Then
Cells(LastTime,3).value = Cells(LastTime,3).Value_
& "<P>" & Cells(x,3).value

Else
LastTime = x
End If

Next x

'For x = LastRow to 2 Step -1

'If cells(x,1)="" then
' rows(x).delete
'End if

'Next x

End Sub
 
Pock,

this is what I meant about text wrap, these two lines should be
written in the VBE window as one line without the underscore ("_")
character. When I reply on the MS site, it has a very narrow text
window. The code should read:

Cells(LastTime,3).value = Cells(LastTime,3).Value & "<p>" &
Cells(x,3).value


Pete
 
Back
Top