Results 1 to 2 of 2

Need help with adjusting/modifying macro to fit my data

Threaded View

thlee1122 Need help with... 08-20-2015, 10:08 AM
xladept Re: Need help with... 08-23-2015, 04:43 PM
  1. #1
    Registered User
    Join Date
    08-06-2015
    Location
    United States, New Jersey
    MS-Off Ver
    2010
    Posts
    10

    Need help with adjusting/modifying macro to fit my data

    Here is the macro vba that inserts a new column on the side and extract the first "expected cost" of each "model" and delete the rest of the rows

    Below is the macro vba that I created.


    Sub FirstValue()
    
    Dim LastRow As Long
    Dim i As Long
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    Range("A1").Offset(0, 1).EntireColumn.Insert
    Range("A1").Value = "Model"
    Range("A1").Offset(0, 1).Value = "Expected Cost"
    
    '''''   TextToColumns to separate expected cost from model
    Range("A2:A" & LastRow).Select
    Application.CutCopyMode = False
    Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
           
    '''''   Delete all but the first of each model
    For i = LastRow To 2 Step -1
        If Cells(i, 1) = Cells(i - 1, 1) Then Cells(i, 1).EntireRow.Delete
    Next i
    
    End Sub
    How do I make this code to fit my dataset below?

    Model(Editable)			Amount Per Unit(Editable)	Expected QTY(Editable)	Expected Cost(Editable)
    WM3370HWA.ABWEPUS               107.                             0.                           4.00
    WM3370HWA.ABWEPUS               107.                             3.                         321.00
    WM3370HWA.ABWEPUS               107.                             0.                          38.00
    WM4270HWA.ABWEPUS               142.                             12.                       1693.00
    WM4270HWA.ABWEPUS               142.                             90.                      12721.00
    WM8000HWA.ABWEEUS               232.                             5.                        1147.00
    WM8000HWA.ABWEEUS               232.                             37.                       8584.00
    WM8000HWA.ABWEEUS               232.                             0.                          29.00
    WT5680HVA.ASSEPUS               151.                             12.                       1800.00
    WT5680HVA.ASSEPUS               151.                             90.                      13519.00
    DLEX4270W.ABWEEUS               142.                             7.                         987.00
    DLEX4270W.ABWEEUS               142.                             52.                       7384.00
    DLEX4270W.ABWEEUS               142.                             0.                          33.00
    WT1801HVA.ASSEEUS               102.                             5.                         483.00
    WT1801HVA.ASSEEUS               102.                             36.                       3626.00
    DLEY1701V.ASSEEUS               113.                             3.                         311.00
    DLEY1701V.ASSEEUS               113.                             21.                       2337.00
    Last edited by JBeaucaire; 08-20-2015 at 08:56 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro: Need help modifying macro, pasting over a row of data
    By idontexcelinexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2014, 11:41 AM
  2. [SOLVED] Macro for Selecting and Modifying Special data in Graph
    By Haidar123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 03:09 PM
  3. Modifying a macro to only clear a cell if it contains data and not a formula
    By ianpwilliams in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2013, 01:09 PM
  4. [SOLVED] Need help adjusting VB macro for appending data to rows with matching index numbers
    By summerela in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2013, 06:20 PM
  5. Need help modifying a macro to open up workbooks and paste filtered data
    By LinkiePoo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2012, 04:14 PM
  6. Modifying sort data macro
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2010, 05:43 PM
  7. Modifying VBA to create new macro for recording data
    By sighlent1 in forum Excel General
    Replies: 2
    Last Post: 12-30-2009, 08:26 PM

Tags for this Thread

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