Forum Discussion

Angel Villela's avatar
Angel Villela
Copper Contributor
Apr 30, 2018
Solved

Repeat Macro

Hi, 

I want to perform this action.

 

PozomDTermina Producción    
CimaBase    
 Sam-9969629781  Sam-9969621
Iride-72511371140   Sam-996978 

 

 So far i´ve been using this macro, but i want this action to be repeated in all the sheet (1500 lines).

Sub Macro6()
'
' Macro6 Macro
'

'
Range("B4").Select
Selection.Copy
Range("G4").Select
ActiveSheet.Paste
Range("C4").Select
Application.CutCopyMode = False
Selection.Copy
Range("G5").Select
ActiveSheet.Paste
Range("D4").Select
Application.CutCopyMode = False
Selection.Copy
Range("H4").Select
ActiveSheet.Paste
Range("A4").Select
Application.CutCopyMode = False
Selection.Copy
Range("F4").Select
ActiveSheet.Paste
Range("F4").Select
Application.CutCopyMode = False
Selection.Copy
Range("F5").Select
ActiveSheet.Paste
End Sub

 

 

Any help would be awesome.

 

 

  • Hi,

     

    This can be done by using Power Query which is also known as (Get & Transform Data in Excel 2016), and if you don't have Excel 2016, then you have to download and install https://www.microsoft.com/en-us/download/details.aspx?id=39379.

     

    The Power Query is much easier than Macros and VBA.

     

    Please find the attached file and try to update the left table, then right-click on the right table and select Refresh to see how it will be updated.

     

    Regards

6 Replies

    • Angel Villela's avatar
      Angel Villela
      Copper Contributor

      Hi Haytham Amairah

       

      What im trying to do, is transpone column B and C, Paste column A twice and paste column C  aside the value in column B.  I need repeat that action in 1500 lines. 

       

      PozomDTermina Producción    
      CimaBase    
       Sam-9969629781  Sam-9969621
      Iride-72511371140   Sam-996978 

       

      Excuse me if im not being clear :(

      • Haytham Amairah's avatar
        Haytham Amairah
        Silver Contributor

        Hi,

         

        This can be done by using Power Query which is also known as (Get & Transform Data in Excel 2016), and if you don't have Excel 2016, then you have to download and install https://www.microsoft.com/en-us/download/details.aspx?id=39379.

         

        The Power Query is much easier than Macros and VBA.

         

        Please find the attached file and try to update the left table, then right-click on the right table and select Refresh to see how it will be updated.

         

        Regards

Resources