data Transpose in VBA loop, choose the part I want to import!

esther723

New Member
Joined
Feb 19, 2013
Messages
7
[h=2]Hello I am working for my school project that I need to follow,

Step 1. Copy from original rep this year row (26:27)
Paste Transpose to data sheet > > Column range E9:F39
Paste Transpose to End report sheet > > Column range B11:C41

Step 2: Copy from original rep this year row (36:37)
Paste Transpose to data sheet > > Column range P9:O39
Paste Transpose to End report sheet > > Column range N11:O41

Step 3: Copy from original rep this year row (46:47)
Paste Transpose to data sheet > > Column range AA9:AB39
Paste Transpose to End report sheet > > Column range Z11:AA41

The question part is how to match the data into certain column since I don't need all of the data from the original report. Please help, thank you so so so much!

I hope this explains. Thanks.[/h]
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Run-time error 9 (subscript out of range) when running macro that I recorded, it shows Sheets("Data").Select as error, do you know how can I fix it? Thank you!


Code:
Sub Import()
'
' Import Macro
'


'
    Range("B26:AF27").Select
    Selection.Copy
    
    Sheets("Data").Select
    Range("E9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep This Year").Select
  
    Range("B30:AF31").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("E48").Select
    Sheets("Data").Select
    Range("I9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep This Year").Select
    Range("B36:AF37").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    Range("P9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep This Year").Select
    
    Range("B40:AF41").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("T9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
   
    Sheets("Original Rep This Year").Select
    
    Range("B46:AF47").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("AA9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
   
    Sheets("Original Rep This Year").Select
    
    Range("B50:AF51").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    
    Range("AE9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    
    Sheets("Original Rep This Year").Select
   
    Range("B28:AF28").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    Range("K9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep This Year").Select
    
    Range("B32:AF32").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    Range("L9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep This Year").Select
    
    Range("B38:AF38").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("V9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
   
    Sheets("Original Rep This Year").Select
    
    Range("B42:AF42").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("W9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    
    Sheets("Original Rep This Year").Select
    
   
    Range("B48:AF48").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("AG9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    
    Sheets("Original Rep This Year").Select
    
    Range("B52:AF52").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
   
    Range("AH9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    
    Sheets("Original Rep Last Year").Select
    Range("B26:AF27").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    Range("G9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep Last Year").Select


    Range("B36:AF37").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("R9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Sheets("Original Rep Last Year").Select
    
    Range("B46:AF47").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Data").Select
    
    Range("AC9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,979
Members
448,934
Latest member
audette89

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