Results 1 to 3 of 3

EXCEL - add formula on specific cells during the insert process

Threaded View

  1. #1
    Registered User
    Join Date
    06-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    29

    EXCEL - add formula on specific cells during the insert process

    Hello everybody!

    Need help on my macro. I would like insert a row based on a cell and add formula on specific cells.

    I have already figured out how to add a row based on a cell -

    
    Sub InsertRowEtc()
    
    Dim myRow As Long
    Dim myCount As Long
    Dim myCol As Integer
    
    myCol = 3
    myCount = ActiveSheet.UsedRange.Rows.Count
    
    For myRow = myCount - 1 To 1 Step -1
    If Cells(myRow, myCol).Value <> Cells(myRow + 1, myCol).Value Then
    Range(Cells(myRow + 1, myCol), Cells(myRow + 1, myCol)).EntireRow.Insert
    
    End If
    Next myRow
    
    End Sub
    This inserts rows based on the 3rd column (in my attachment, it's the Vegetable column. In my attachment. I have two tabs - one is what the result should be and the other is what the raw/original data looks like.. Basically I need to insert gray rows in every different Vegetable (column C).

    I would like to add a formula for sumifs and averageif for column L, M and N. But my ultimate problem is I have no idea how to convert AVERAGEIF formula to a 2003 version. I have worked with COUNT then IF or even COUNTA then IF then use them for my SUM IF but to no avail.. Or even AVERAGE IF but I always have a problem with those data that skip their numbers (ie Amount, Count and Average column as seen on my attachment.)
    I have 7000 rows of this to work on so a Macro would come in handy.

    Any help is a great help.. Thanks guys!
    Attached Files Attached Files
    Last edited by eastydie; 06-21-2011 at 01:29 AM.

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