Deleting row with a comma in the tread

seemz

New Member
Joined
Aug 8, 2011
Messages
4
I want to write a code in excel for strings that don't start with a ",".

It would great appreciated if someone could help
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the board...

You're not giving a whole lot to go on...

But you can likely use the Left Function to determine if the first character is a comma.
Code:
If Left(Range("A1"),1) <> "," Then
    'Do some stuff
End If


Hope that helps.
 
Upvote 0
I always hate it when I get commas stuck in the tread; my truck starts skittering all over.

Seriously, what is the code supposed to do?
 
Upvote 0
I am extremely sorry. How do I use this as a loop a?

Here is an example of the data:

PeopleSoft Ledger
Date 07-18-2000
Month, 11, Dept

,60990, Don't want to delet this line.
,60990, Don't want to delet this line.
,60990, Don't want to delet this line.
,60990, Don't want to delet this line.
,60990, Don't want to delet this line.

<TABLE style="WIDTH: 192pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=256><COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; WIDTH: 192pt; HEIGHT: 12.75pt; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8; mso-ignore: colspan" height=17 width=256 colSpan=4>Monthly,2010-01,Total, 0.00</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8; mso-ignore: colspan" height=17 colSpan=4>Year to Date Total, 0.00</TD></TR></TBODY></TABLE>

,60990, Don't want to delet this line.
,60990, Don't want to delet this line.
 
Upvote 0
So you want to delete every row EXCEPT those that begin with a comma?
Assuming that is data in column A

Try
Code:
Sub Test
Dim i As Long, LR As Long
LR = Cells(Rows.Count, "A").End(xlup).Row
For i = LR To 2 Step - 1
    If Left(Cells(i,"A").Value, 1) <> "," Then
        Rows(i).EntireRow.Delete
    End If
Next i
End Sub
 
Upvote 0
Loop stops in the Middle

My loop just stops in the middle. Any suggestion to fix this problem


Dim rownumber As Long
Dim rcount As Long

rownumber = 1

rcount = ActiveSheet.UsedRange.Rows.Count

Do
Range("S7").Offset(rownumber).Select
If ActiveCell = "x" Then
ActiveCell.Offset(0, 1).Range("A1").Select
Application.Run "Explain"
Application.Run "Filter1"
Application.Run "Filter2"
Application.Run "Filter3"
rcount = rcount - 1
Else
rownumber = rownumber + 1
End If


Loop Until rownumber = rcount
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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