Delete text in row or column after < and delete the < too

rickadams

New Member
Joined
Feb 11, 2018
Messages
32
I am looking for a VBA to delete All the text after the < and the < too
My Sheet has Columns A Thru J and can be anywhere from 2 to 200 rows

IE:

[TABLE="class: cms_table, width: 226"]
<tbody>[TR]
[TD="width: 226"]Mrs. Melissa <8268513.cskm>
Needs to just be
Mrs. Melissa[/TD]
[/TR]
</tbody>[/TABLE]

So I need to delete everything after the < and the < too.

<anytown, nj="" 02220="">Everything I have tried in VBA gives me errors.

Thank you</anytown,>
 
Last edited:
You are welcome. :)


Try
Code:
Range("F" & Rows.Count).End(xlUp).Offset(1).FormulaR1C1 = "=SUM(R1C:R[-1]C)"

Thank you all!!! Everything is working great. My next question (or should I start a new thread?) how would I make that totaled box bold and highlighted yellow?
 
Last edited by a moderator:
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
should I start a new thread?
Yes. Unless it is a follow-up question the depends on previous responses, it is best to post new questions in new threads.
That way they will show up in the "Zero Reply Posts" listing as new unanswered questions, and will get more looks.
 
Upvote 0
Yes. Unless it is a follow-up question the depends on previous responses,...
I agree, but this is a follow-up. :)


.. how would I make that totaled box bold and highlighted yellow?
Take out the code line I suggested in post #10 , & insert this instead.
Code:
With Range("F" & Rows.Count).End(xlUp).Offset(1)
  .FormulaR1C1 = "=SUM(R2C:R[-1]C)"
  .Font.Bold = True
  .Interior.Color = vbYellow
End With
 
Upvote 0
I agree, but this is a follow-up.
That is why I included the part about it being dependent upon the previous response...
It might have not too clear, because I chose the wrong word. It should say "... that depends ...", not "... the depends ...".

Just about everything could be considered a "follow-up". The question is, is it a dependent follow-up?
Can the question stand on its own and make sense without having to know the prior question and answer?
 
Last edited:
Upvote 0
I agree, but this is a follow-up. :)


Take out the code line I suggested in post #10 , & insert this instead.
Code:
Sub ReplaceLessThanAndFollowingText()' Get rid of all the junk in all rows and columns that have <between greater="" less=""> that was inported from the spreadsheet.
  Columns("B:I").Replace "<*", "", xlPart, , , , False, False
  ' We dont use Column G so remove that Column
  Columns(7).EntireColumn.Delete
  ' Autofit all columns
    ActiveSheet.Range("A1:I1").EntireColumn.AutoFit
    ' Now format column F as dollars
   Range("E:F").NumberFormat = "$#,##0.00"
    ' Now Autocalculate Column F, Then Bold and color the total Yellow
    With Range("F" & Rows.Count).End(xlUp).Offset(1)
  .FormulaR1C1 = "=SUM(R2C:R[-1]C)"
  .Font.Bold = True
  .Interior.Color = vbYellow
End With
    ' Put Boarders Boarders arund Everythibg
    With ActiveSheet.UsedRange.Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
        
End Sub
End With

This is the code completed (so far) LOL

WOW Peter this works Fantastic!!! I was actually typing a new post when I saw you responded. Thank you!</between>
 
Last edited:
Upvote 0
Thank you to EVERYONE that helped with this project!

I wish I could wrap my head around VBA!

I keep getting confused with some of the old "Basic Programming" code like:

Code:
IF LEFT$(Q$, 2) = "SU" THEN OD = VAL(MID$(Q$, 3, (LEN(Q$)))): DE$ = "SU": S = 1: OD = 1: PE = 24: PT$ = "PACKAGING & UPS CHARGE ": SV$ = "UPS ZONE" + (MID$(Q$, 3, (LEN(Q$)))): GOSUB 1530: GOTO 1880:  ELSE DE$ = "EA"

<between greater="" less="">
[/QUOTE]
</between>
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top