+ Reply to Thread
Results 1 to 2 of 2

Find a string and then insert new row above the SUM Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    11-28-2008
    Location
    Palembang
    Posts
    66

    Find a string and then insert new row above the SUM Formula

    Hi Bos ? Can u help me again please.
    How to Find a string and then insert new row above the SUM Formula ?
    I have attached the Example file (Example.xls)

    thanks b4
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Find a string and then insert new row above the SUM Formula

    Hi, Try this:-
    Sub MG23Nov03
    Dim txt As String
    Dim Rng As Range, Dn As Range
    On Error Resume Next
     txt = Application.InputBox(prompt:="Please Select ", Title:="Insert Brackets", Type:=2)
    If txt = "" Then Exit Sub
    
    Set Rng = Range(Range("f6"), Range("f" & Rows.Count).End(xlUp))
        For Each Dn In Rng
            If Dn.Offset(, -2) = txt Then
                Dn.Offset(1).EntireRow.Insert
                Dn.Offset(2).Formula = "= sum(" & Dn.Address(0, 0) & ":" & Dn.Offset(1).Address(0, 0) & ")"
            End If
        Next Dn
    End Sub
    
    End Sub
    Regards Mick

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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