excel macro

Hi All,

i am looking for an excel macro to convert the excel file, i am attaching the excel file. once i run the macro i want the out put of the file as Workbook4.  I am looking from workbook5 to workbook4 once i run the macro file. and in column c i want where the length is equal to 6 only. if the length is more than 6 then those rows has to be deleted.
Workbook4.xlsx
Workbook5.xlsx
romeiovasuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Basis of your data..You can run this code and it will do what you are looking for..

Sub arrngedata()
    Rows("1:6").Delete

    Range("A:B,E:E,G:O,Q:Z,AB:AN").Delete
    Range("A1").Value = "POrderNo"
    Range("B1").Value = "Customer"
    Range("C1").Value = "ShiptoCode"
    Range("D1").Value = "VendorSKU"
    Range("E1").Value = "Serial"

    Cells.EntireColumn.AutoFit
End Sub

Open in new window


Saurabh...
romeiovasuAuthor Commented:
There is a problem the column c convert into just number 6.  NO if the len of the character is more than 6 those rows should be deleted. other than that the data in that column should change.
Saurabh Singh TeotiaCommented:
I dont understand what you are saying or trying to do as i run on the sample file that you uploaded in workbook5 and it gives you the result of workbook4..

Saurabh...
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

romeiovasuAuthor Commented:
sorry i meant in the column c you see
107854
107854
107882 DENTON
107882 DENTON

if the length is more than 6 characters, then those rows should be deleted too.

i need only for the rows who length is 6 characters
Saurabh Singh TeotiaCommented:
Use this code...

Sub arrngedata()
    Rows("1:6").Delete

    Range("A:B,E:E,G:O,Q:Z,AB:AN").Delete
    Range("A1").Value = "POrderNo"
    Range("B1").Value = "Customer"
    Range("C1").Value = "ShiptoCode"
    Range("D1").Value = "VendorSKU"
    Range("E1").Value = "Serial"

    Cells.EntireColumn.AutoFit

    Dim i As Long
    i = 2
    Do Until i > Cells(Cells.Rows.Count, "A").End(xlUp).Row
        If Len(Cells(i, "a").Value) > 6 Then
            Rows(i).Delete
        Else
            i = i + 1
        End If


    Loop

End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
romeiovasuAuthor Commented:
This is Awesome, you are unbelievable.
Saurabh Singh TeotiaCommented:
Thanks for the appreciation..Always happy to help.. :-)

Saurabh...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.