*** 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
AirPortItem IDNB #NB #Item NameItem LocItem DestItem/Rec TimeAir CargoNB ID
AEP4532C211C211SpiderOERKOFGH4352
A2158C211C211DavidOERKOFGH4353
PZ4895C211C211PurseOERKOFGH4354
A4258C451C451BearOERKOFGH4355
SPFE4525C321C321TearOERKOFGH4356
P4875C487C487TacoOERKOFGH3530
P6985C585C585ZipperOERKOFGH3531
PO4789C459C459PunchOERKOFGH3532
UEAZ4823C596C596ApexiOERKOFGH3533
P7524HELVC417DracOERKOFGH3534

<tbody>
</tbody><colgroup><col span="4"><col><col><col><col><col span="2"></colgroup>


Desired Output:

A B C D E F G H I J

AirPortItem IDNB #NB #Item NameItem LocItem DestItem/Rec TimeAir CargoNB ID
AEP4532C211C211SpiderOERKOFGH4352
AEA2158C211C211DavidOERKOFGH4353
AEPZ4895C211C211PurseOERKOFGH4354
AEA4258C451C451BearOERKOFGH4355
SPFE4525C321C321TearOERKOFGH4356
SPP4875C487C487TacoOERKOFGH3530
SPP6985C585C585ZipperOERKOFGH3531
SPPO4789C459C459PunchOERKOFGH3532
UEAZ4823C596C596ApexiOERKOFGH3533
UEP7524HELVC417DracOERKOFGH3534

<tbody>
</tbody><colgroup><col span="4"><col><col><col><col><col span="2"></colgroup>



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

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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 :LOL:


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,217,119
Messages
6,134,751
Members
449,887
Latest member
robyngknapp

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