Skip to main content

Get GSTR 2A B2B sheet edit in one click for 2A reco using macro vba

How to structure the data of GSTR 2A B2B in one click for 2A reco


All you spent lots of time in data structuring in office such as remove space between the rows,remove the first few rows,Merged the cells



What if , all this done on single click


U save lots of precious time


Here is the steps


1 open the sheet


2. open the vba by ALT +F11

3. Add the module


4. copy the below code


Sub Macro1()
    Rows("1:4").Select
    Range("P1").Activate
    Selection.Delete Shift:=xlUp
    ActiveWindow.ScrollColumn = 10
    ActiveWindow.ScrollColumn = 11
    ActiveWindow.LargeScroll ToRight:=-1
    ActiveSheet.Shapes.Range(Array("Picture 1")).Select
    Selection.Delete
    Range("C1:F1").Select
    Selection.ClearContents
    Range("C1:F1").Select
    ActiveCell.FormulaR1C1 = ""
    Range("C1:F1").Select
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With
    Selection.UnMerge
    Range("J1:J2").Select
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    Range("K1:N1").Select
    Selection.ClearContents
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With
    Selection.UnMerge
    ActiveWindow.ScrollColumn = 5
    Range("N1").Select
    ActiveCell.FormulaR1C1 = ""
    Range("N1:N2").Select
    Range("N2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("M1:M2").Select
    Range("M2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("L1:L2").Select
    Range("L2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("K1:K2").Select
    Range("K2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("F1:F2").Select
    Range("F2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("E1:E2").Select
    Range("E2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("D1:D2").Select
    Range("D2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Range("C1:C2").Select
    Range("C2").Activate
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Cells.Select
    Selection.AutoFilter
    Range("D1:D2").Select
    ActiveSheet.Range("$A$1:$O$1043").AutoFilter Field:=4, Criteria1:="="
    Rows("5:5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Delete Shift:=xlUp
    ActiveSheet.Range("$A$1:$O$697").AutoFilter Field:=4
    ActiveSheet.Range("$A$1:$O$697").AutoFilter Field:=9, Criteria1:=Array("0", _
        "12", "18", "28", "5", "="), Operator:=xlFilterValues
    Rows("3:3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Delete Shift:=xlUp
    Range("A346").Select
    ActiveSheet.Range("$A$1:$O$345").AutoFilter Field:=9, Criteria1:="<>"
    Columns("C:C").Select
    Selection.Replace What:="-total", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    With Selection
        .HorizontalAlignment = xlLeft
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
    End With
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.SmallScroll Down:=171
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
End Sub
 

 paste it in module.


5. then minimize the visual basic and select the B2B sheet only (not any other , or you lost the data )

6. then press ALT + F11 and then press F5




you get your sheet ready

All this code are verified

Only for B2B sheet , not any other sheet

Precaution : only B2B sheet open

If any of your data is lost , we are not responsible for your loss



For safety apply it on duplicate file , not in original file



Comments

Popular posts from this blog

GSTR 1 CDNR sheet Editing

You spent lots of time in structuring the CDNR sheet for future working. It easy for 1 time, took more time if you have 2 sheets but if you have more than 5 sheets then this trick helps you in time-saving and from machine work. It simple and easy  Here are the steps : Press ALT +F11 insert new module copy the code and paste in module Sub vir() Application.ScreenUpdating =false     Rows("1:4").Select     Range("O1").Activate     Selection.Delete Shift:=xlUp     ActiveSheet.Shapes.Range(Array("Picture 1")).Select     Selection.Delete     Range("C1:F1").Select     Selection.ClearContents     Range("J1:M1").Select     Selection.ClearContents     Range("A1:A2").Select     With Selection         .HorizontalAlignment = xlGeneral         .VerticalAlignment = xlCenter         .WrapText = True         .Or...

Excel Shortcut Keys

Everyone wants speed in every work, to get speed in excel you used shortcuts for different operations, which is very useful in saving time ,you become a speeder in excel ,that save lots of time Close a workbook Ctrl+W Open a workbook Ctrl+O Go to the  Home  tab Alt+H Save a workbook Ctrl+S Copy Ctrl+C Paste Ctrl+V Undo Ctrl+Z Remove cell contents Delete Choose a fill color Alt+H, H Cut Ctrl+X Go to  Insert  tab Alt+N Bold Ctrl+B Center align cell contents Alt+H, A, C Go to  Page Layout  tab Alt+P Go to  Data  tab Alt+A Go to  View  tab Alt+W Open context menu Shift+F10, o...

autofit rows and column in excel vba

Everytime we copy the data  and paste in new sheet , it get unfit . Some data unvisible and Column are not unfit .we require to column auto resize  method 1 press  CTRL + A  then press Alt then button H then button O then button I it easy but if you have many sheet method 2 copy it on module Sub autofit ()  Rows. Entirerow. Autofit Columns. Entirecolumn. Autofit  End sub