Fill Data To A L Shape Long

CellR1C1

New Member
Joined
Feb 23, 2018
Messages
2
Hello
I have some data in the column A , would like to convert it to L shaped Long in related cells.
Please hit the F8 to see what is happening!
Thank u.


Code:
Sub FillDataToL()

    Range("A1").Select
    ActiveCell.FormulaR1C1 = "W18"
    Range("A1").Select
    Selection.AutoFill Destination:=Range("A1:A20"), Type:=xlFillDefault
    Range("A1:A20").Select
    Columns("B:N").Select
    Selection.ColumnWidth = 2.29
    Range("C1:C10,D10,D10:N10").Select
    Range("D10").Activate
    ActiveWorkbook.Names.Add Name:="LongT", RefersToR1C1:= _
        "=Sheet1!R1C3:R10C3,Sheet1!R10C4,Sheet1!R10C4:R10C14"
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Application.Goto Reference:="LongT"
    Range("A1:A15").Select
    Application.CutCopyMode = False
    Range("A1:A20").Select
    Selection.Copy
    Application.Goto Reference:="LongT"
    Range("C1").Select
    Application.Goto Reference:="LongT"
    Range("C1:C10,D10,D10:N10").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C2").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C3").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C4").Activate
    ActiveCell.FormulaR1C1 = "=R[1]C[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C5").Activate
    ActiveCell.FormulaR1C1 = "=R[1]C[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C6").Activate
    ActiveCell.FormulaR1C1 = "=R[1]C[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C7").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C8").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C9").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("C10").Activate
    ActiveCell.FormulaR1C1 = "=RC[-2]"
    Range("C1:C10,D10,D10:N10").Select
    Range("D10").Activate
    ActiveCell.FormulaR1C1 = "=R[1]C[-3]"
    Range("C1:C10,D10,D10:N10").Select
    Range("D10").Activate
    ActiveCell.FormulaR1C1 = "=R[2]C[-3]"
    Range("C1:C10,D10,D10:N10").Select
    Range("E10").Activate
    ActiveCell.FormulaR1C1 = "=R[4]C[-4]"
    Range("C1:C10,D10,D10:N10").Select
    Range("F10").Activate
    ActiveCell.FormulaR1C1 = "=R[5]C[-5]"
    Range("C1:C10,D10,D10:N10").Select
    Range("G10").Activate
    ActiveCell.FormulaR1C1 = "=R[6]C[-6]"
    Range("C1:C10,D10,D10:N10").Select
    Range("H10").Activate
    ActiveCell.FormulaR1C1 = "=R[6]C[-7]"
    Cells.Select
    Cells.EntireColumn.AutoFit
    Range("E14").Select
    ActiveWindow.SmallScroll Down:=-75
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "a"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A6").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A7").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A8").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A9").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A10").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A11").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A12").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A13").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A14").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A15").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A16").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A17").Select
    ActiveCell.FormulaR1C1 = "s"
    Range("A1").Select
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,226,113
Messages
6,189,046
Members
453,522
Latest member
Seeker2025

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