Need help on Marco

howdy11354

New Member
Joined
Apr 17, 2009
Messages
19
I have all these spreadsheets from different vendors and all of these spreadsheets are in totally different formats. Is there a way I can create one macro and apply this one macro to all spreadsheets to get me a standard format?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
ok so are you trying to copy/repeat the data in column A to each item till the blank line then repeat for the next? Your macro showed it starting in A5, but the file has the data starting in A1. Need a little more info
 
Upvote 0
I deleted some information on the file that I sent you. What I really need to do is to have a macro copying from A1 through A7 for product TKSA, A9 through A13 for product TKDEV, and so on...Then I need to concatenate Column A and column C to make a full description. Thx.
 
Upvote 0
ok so this is how I would work the macro

Code:
Sub format()
Dim LR As Long
LR = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
    
    Cells.Select
    Cells.AutoFilter Field:=3, Criteria1:="<>"
    Cells.AutoFilter Field:=1, Criteria1:="="
    Range("A2").FormulaR1C1 = "=+R[-1]C"
    Range("G2").FormulaR1C1 = "=RC[-6]&"" ""&RC[-4]"
    Range("A2").Copy
    Range("A2:A" & LR).SpecialCells(xlCellTypeVisible).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Cells.AutoFilter Field:=3
    Cells.AutoFilter Field:=1, Criteria1:="<>"
    Range("G2").Copy
    Range("G2:G" & LR).SpecialCells(xlCellTypeVisible).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Range("A1").AutoFilter
    Range("A1").Select
    Columns("A").Copy
    Columns("A").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    Columns("G").Copy
    Columns("G").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    Application.CutCopyMode = False
    Columns("G:G").EntireColumn.AutoFit
    Range("A1").Select

End Sub

Let me know how it goes. HTH
 
Upvote 0
Awesome! it works. Is it hard to edit the codes? I have about 50 vendors and each vendor has its own format. I wonder if I have the ability to create one macro for each vendor.
 
Upvote 0
doing is learning :wink:

but to create another copy of the macro goto Tools - Macro - Macros - click (once) on the "format" macro, then click edit. Now do a CTRL+A (selects all), then do a CTRL+C (copy), now press CTRL + END, then press CTRL + V (paste). You will have a copy of the macro, now immediately go to the second "SUB Format" line and change that to something else "Sub Format_Vendor2" (suggestion). Then you can change the parts that are different. If you need help, post back with the differences for the 2nd layout.

edit: Also I would probably not keep copying/paste into the same Module, but perhaps insert a new module to paste the code into.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top