ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Please Cut/Paste Macro for DVD Subtitles (https://www.excelbanter.com/excel-programming/273668-help-please-cut-paste-macro-dvd-subtitles.html)

Pete McCosh[_5_]

Help Please Cut/Paste Macro for DVD Subtitles
 
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




Pete McCosh[_6_]

Help Please Cut/Paste Macro for DVD Subtitles
 
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

Pock wrote in message ...
Pete,

Thanks a ton for your response. However, when I tried your code, the
following line wouldn't compile:

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

It seemed to get stuck after the ampersand. Forgive me for my lack of
coding genius. I took out the spaces but that still didn't help.

Any suggestions?

Thanks,
Pock

--------------------------------------
remove I_hate_SPAM_ from my address
when sending me an email

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com