vba_php
Forum Troll
- Local time
- Today, 00:48
- Joined
- Oct 6, 2019
- Messages
- 2,884
Can one of you guys help me spot my error here? I'm pretty sure I'm doing everything right, yet Excel is wrong. What am I not catching? These are my input records:
this is my code routine:
and this is what I'm getting as a result:
but what i want as a result is this:
Help, anyone? It *is* early in the morning, so I may have messed this one up....
this is my code routine:
Code:
Function extract_file_prefix_nameand_print_new_URL()
On Error Resume Next
Dim filePrefixFull As String
Dim filePrefixShort As String
Dim fileprefixprev As String
Dim filePrefix_Transact As String
Dim fileName As String
Dim a1Start As Long
Dim a1End As Long
Dim length As Long
Dim newHref As String
Dim ws As Worksheet
Set ws = ActiveWorkbook.Worksheets("tbl")
Application.ScreenUpdating = False
Dim r As Range
For Each r In ws.Range("r65", "r118")
If Not Left(r, 4) = "<h3>" Then
a1Start = InStr(r, "software/") + 9
a1End = InStr(r, ".php")
length = a1End - a1Start
filePrefixFull = Mid(r, a1Start, length)
a1Start = InStr(r, "software/") + 9
a1End = InStr(r, "-")
length = a1End - a1Start
filePrefixShort = Mid(r, a1Start, length)
a1Start = InStr(r, "software/") + 9
a1End = InStr(r, """" & ">")
length = a1End - a1Start
fileName = Mid(r, a1Start, length)
If InStr(filePrefixFull, fileprefixprev) = 0 Or fileprefixprev = "" Then 'new software type reached
filePrefix_Transact = filePrefixFull
Else
filePrefix_Transact = fileprefixprev
End If
fileprefixprev = filePrefixFull
newHref = Replace(r, "software/", "software/" & filePrefix_Transact & "/" & fileName)
r.Offset(0, -1) = newHref
End If
Next r
Application.ScreenUpdating = True
End Function
and this is what I'm getting as a result:
but what i want as a result is this:
Help, anyone? It *is* early in the morning, so I may have messed this one up....
Last edited: