+ Reply to Thread
Results 1 to 2 of 2

Delete row if first 5 charactres equal to total

  1. #1
    Registered User
    Join Date
    08-06-2014
    Location
    Pune, India
    MS-Off Ver
    2010
    Posts
    84

    Delete row if first 5 charactres equal to total

    Hi All,
    I am using below code to delete rows if cells from L4 to L& Last Row has first 5 characters as "Total".
    I am getting error, "Wrong number of arguments or invalid property assignment". Code is placed in Module.
    Code is as below:

    Sub RowDelete()
    Dim PT4 As Worksheet
    Set PT4 = Worksheets("Sheet1")
    Dim finalRow2 As Long
    finalRow2 = PT4.Cells(Application.Rows.Count, 1).End(xlUp).Row
    Dim i As Integer
    i = 4
    Do Until i = finalRow2
    If left(CStr(Cells(i, 12).Value), 5) = "Total" Then
    Rows(i).Delete xlShiftUp
    Else
    i = i + 1
    End If
    Loop
    End Sub

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,054

    Re: Delete row if first 5 charactres equal to total

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Never use Merged Cells in Excel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Delete row if total is equal to 0.00%
    By csch123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2013, 12:50 PM
  2. [SOLVED] Deleting rows where sum total equal to Zero
    By itsmesunilb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2012, 06:35 PM
  3. [SOLVED] Need Popup box if total does not equal to 100%
    By chiru7963 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-08-2012, 07:00 AM
  4. [SOLVED] Total text boxes to equal 100
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-07-2012, 03:11 PM
  5. How to make X equal total?
    By Beginner12 in forum Excel General
    Replies: 1
    Last Post: 03-31-2012, 09:17 PM
  6. random numbers to equal a total
    By dealer in forum Excel General
    Replies: 8
    Last Post: 10-11-2010, 05:52 PM
  7. Finding amounts equal to one total
    By Frank R via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2005, 11:40 PM
  8. How do I set a formula in a cell to equal the total in another ce.
    By dizzyd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1