+ Reply to Thread
Results 1 to 7 of 7

The rest is to be deleted except for the bill no. lines

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-16-2018
    Location
    India
    MS-Off Ver
    2021
    Posts
    183

    The rest is to be deleted except for the bill no. lines

    Dear all,

    I have a sheet that comes output from a software, which I have placed in the main data sheet. It has to be converted to step by step which I have shown in sheets.
    Step 4 is my last sheet i need FROM VBA CODE.


    also enclosed herewith pics & sheet attached.

    Thank u in Advanced..

    STEP-1-001.png
    STEP-2-001.png
    STEP-3-001.png
    STEP-4-FINAL.png
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    536

    Re: The rest is to be deleted except for the bill no. lines

    Check my suggestion.
    You have to change the names because they are different, e.g. the 'MAIN DATA' sheet is "LIBERTY WINES, SOLAPUR (Pro", and in the 'CUSTOMER DATA' sheet is "LIBERTY WINES, SOLAPUR (Prop.Sandeep Talreja)".
    The results are in sheet 'DATA CONVERT STEP-4- & FINAL' from cell J4.
    HTML Code: 
    Best Regards,
    Maras.

  3. #3
    Forum Contributor
    Join Date
    06-16-2018
    Location
    India
    MS-Off Ver
    2021
    Posts
    183

    Re: The rest is to be deleted except for the bill no. lines

    Sir, Thanks for the reply,
    when i run this code , Showing Display error , ( expected array )

    pls check..

  4. #4
    Forum Contributor
    Join Date
    06-16-2018
    Location
    India
    MS-Off Ver
    2021
    Posts
    183

    Re: The rest is to be deleted except for the bill no. lines

    Sir, Actually
    LIBERTY WINES, SOLAPUR (Pro is the name of this customer group, their under their name is LOTUS WINES**, LIBERTY WINES***, LUCKY WINES**

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: The rest is to be deleted except for the bill no. lines

    Try
    Sub test()
        Dim a, b, i As Long, ii As Long, txt As String, w, x
        b = Application.Trim(Sheets("CUSTOMER DATA").Cells(1).CurrentRegion.Value)
        a = Application.Trim(Sheets("MAIN DATA").[a3].CurrentRegion.Value)
        With CreateObject("Scripting.Dictionary")
            For i = 2 To UBound(a, 1)
                If a(i, 1) = "" Then a(i, 1) = a(i - 1, 1)
                If a(i, 2) <> "" Then
                    txt = Join(Array(a(i, 1), a(i, 2), a(i, 3)), Chr(2))
                    If Not .exists(txt) Then
                        ReDim w(1 To 8)
                        For ii = 1 To UBound(a, 2)
                            w(ii + IIf(ii > 1, 1, 0)) = a(i, ii)
                        Next
                        x = Application.Match(a(i, 1) & "*", Application.Index(b, 0, 3), 0)
                        If IsNumeric(x) Then w(2) = b(x, 4)
                        .Item(txt) = w
                    End If
                End If
            Next
            a = Application.Index(.items, 0, 0)
        End With
        With Sheets.Add
            Sheets("main data").Rows(3).Copy .[a3]
            .[b3].Insert xlShiftToRight
            .[b3].Value = "Company ID"
            .[a4].Resize(UBound(a, 1), UBound(a, 2)) = a
            .[a3].CurrentRegion.Borders.Weight = 2
            .Columns.AutoFit
        End With
    End Sub
    Last edited by jindon; 10-07-2019 at 08:03 AM. Reason: fixed a typo

  6. #6
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    536

    Re: The rest is to be deleted except for the bill no. lines

    sbvaram, you were right. There was a problem with the tables declaration.
    The corrected code below.
    HTML Code: 

  7. #7
    Forum Contributor
    Join Date
    06-16-2018
    Location
    India
    MS-Off Ver
    2021
    Posts
    183

    Re: The rest is to be deleted except for the bill no. lines

    Yess... Correct , 100% perfect...
    Thank u Very Much sir,

    Sorry, I did not reply to you yesterday, yesterday was the office holiday.

    Thank u once again!!!

+ 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. Formula for billing statement between bill cycle date and bill due date?
    By etonsketon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-27-2019, 11:17 PM
  2. Replies: 1
    Last Post: 12-06-2017, 01:58 AM
  3. Turning off bill of material lines in quoting template
    By cheddarthief in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2014, 03:26 PM
  4. Replies: 3
    Last Post: 07-10-2014, 12:06 PM
  5. [SOLVED] Complicated Macro doesn't work properly if lines are deleted
    By BuzzOffSweetheart in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-11-2012, 01:32 PM
  6. Macro : To find word and Select rest after this cell and delete rest
    By Zortabello in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2010, 08:06 AM
  7. Replies: 1
    Last Post: 09-29-2005, 02:05 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