*** Copy and Paste Help *** Excel Example Within

gcbutter

New Member
Joined
Mar 4, 2015
Messages
16
Good afternoon everyone. I need a simple vba to take copy the value in the A Column and paste it down to the next value (Same Column) and so on. Here is the Active sheet view:

A B C D E F G H I J
[TABLE="class: grid, width: 681"]
<tbody>[TR]
[TD]AirPort[/TD]
[TD]Item ID[/TD]
[TD]NB #[/TD]
[TD]NB #[/TD]
[TD]Item Name[/TD]
[TD]Item Loc[/TD]
[TD]Item Dest[/TD]
[TD]Item/Rec Time[/TD]
[TD]Air Cargo[/TD]
[TD]NB ID[/TD]
[/TR]
[TR]
[TD]AE[/TD]
[TD]P4532[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]Spider[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4352[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A2158[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]David[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4353[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]PZ4895[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]Purse[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4354[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A4258[/TD]
[TD]C451[/TD]
[TD]C451[/TD]
[TD]Bear[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4355[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]FE4525[/TD]
[TD]C321[/TD]
[TD]C321[/TD]
[TD]Tear[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4356[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]P4875[/TD]
[TD]C487[/TD]
[TD]C487[/TD]
[TD]Taco[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3530[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]P6985[/TD]
[TD]C585[/TD]
[TD]C585[/TD]
[TD]Zipper[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3531[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]PO4789[/TD]
[TD]C459[/TD]
[TD]C459[/TD]
[TD]Punch[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3532[/TD]
[/TR]
[TR]
[TD]UE[/TD]
[TD]AZ4823[/TD]
[TD]C596[/TD]
[TD]C596[/TD]
[TD]Apexi[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3533[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]P7524[/TD]
[TD]HELV[/TD]
[TD]C417[/TD]
[TD]Drac[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3534[/TD]
[/TR]
</tbody><colgroup><col span="4"><col><col><col><col><col span="2"></colgroup>[/TABLE]


Desired Output:

A B C D E F G H I J

[TABLE="class: grid, width: 681"]
<tbody>[TR]
[TD]AirPort[/TD]
[TD]Item ID[/TD]
[TD]NB #[/TD]
[TD]NB #[/TD]
[TD]Item Name[/TD]
[TD]Item Loc[/TD]
[TD]Item Dest[/TD]
[TD]Item/Rec Time[/TD]
[TD]Air Cargo[/TD]
[TD]NB ID[/TD]
[/TR]
[TR]
[TD]AE[/TD]
[TD]P4532[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]Spider[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4352[/TD]
[/TR]
[TR]
[TD]AE[/TD]
[TD]A2158[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]David[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4353[/TD]
[/TR]
[TR]
[TD]AE[/TD]
[TD]PZ4895[/TD]
[TD]C211[/TD]
[TD]C211[/TD]
[TD]Purse[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4354[/TD]
[/TR]
[TR]
[TD]AE[/TD]
[TD]A4258[/TD]
[TD]C451[/TD]
[TD]C451[/TD]
[TD]Bear[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4355[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]FE4525[/TD]
[TD]C321[/TD]
[TD]C321[/TD]
[TD]Tear[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4356[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]P4875[/TD]
[TD]C487[/TD]
[TD]C487[/TD]
[TD]Taco[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3530[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]P6985[/TD]
[TD]C585[/TD]
[TD]C585[/TD]
[TD]Zipper[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3531[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]PO4789[/TD]
[TD]C459[/TD]
[TD]C459[/TD]
[TD]Punch[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3532[/TD]
[/TR]
[TR]
[TD]UE[/TD]
[TD]AZ4823[/TD]
[TD]C596[/TD]
[TD]C596[/TD]
[TD]Apexi[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3533[/TD]
[/TR]
[TR]
[TD]UE[/TD]
[TD]P7524[/TD]
[TD]HELV[/TD]
[TD]C417[/TD]
[TD]Drac[/TD]
[TD]OERK[/TD]
[TD]OFGH[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3534[/TD]
[/TR]
</tbody><colgroup><col span="4"><col><col><col><col><col span="2"></colgroup>[/TABLE]



Thank you and I look foward to your replie(s).
 
Try

Code:
Sub FillB3()
    Dim c As Range

    For Each c In Range("a2:a" & Range("b" & Rows.Count).End(xlUp).Row)
        If Left(c.Value, 1) = Chr(32) Then
        c.FormulaR1C1 = "=R[-1]C"
        c.Value = c.Value
    Next

End Sub
 
Upvote 0
MARK858, the second code worked perfectly; Thakn you! I just wish I had skills like you sir...

Side note: Where did you receive your vba education from?
 
Upvote 0
Side note: Where did you receive your vba education from?

Practice, necessity(work) and reading forums like this one (and some books), basically purely amateur and still a lot to learn :laugh:


Even though it is probably overkill can you see if the code below works in your circumstance?

Rich (BB code):
Sub FillC()
    Dim Afill As Range, v As Variant, i As Long

    With Range("a2:a" & Range("b" & Rows.Count).End(xlUp).Row)

        v = .Value2
        For i = LBound(v) To UBound(v)
            v(i, 1) = Application.WorksheetFunction.Trim(v(i, 1))
        Next
        .Value = v

        On Error Resume Next
        For Each Afill In .SpecialCells(xlCellTypeBlanks).Areas
            Afill.Value = Afill(1).Offset(-1).Value
        Next
        On Error GoTo 0
    End With

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,859
Messages
6,193,397
Members
453,794
Latest member
slilesy

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