Copy ActiveWorksheet Columns B,C,F to Another Worksheet in Workboo

G

Guest

I would like to copy from the ActiveWorksheet Columns B2,C2,F2 starting at
row 3 until B column row is null to the TEST worksheet. The TEST worksheet
will start at row 2 because of headers the column mappings will correspond to
the list below.


ActiveWorksheet.Column Test.Column
B D
C F
F H

Please help me with this script.

Thanks so much for your help.
 
S

Steve Yandl

I think I understand what you want to do. See if the sub below takes care
of it.

_________________________________

Sub TransferColumns()
Dim rngOriginB As Range
Dim rngOriginC As Range
Dim rngOriginF As Range

Dim rowTop As Integer

Application.ScreenUpdating = False

rowTop = Range("B65536").End(xlUp).Row

Set rngOriginB = Range("B3:B" & rowTop)
Set rngOriginC = Range("C3:C" & rowTop)
Set rngOriginF = Range("F3:F" & rowTop)

rngOriginB.Copy
Sheets("Test").Activate
ActiveSheet.Paste (Sheets("Test").Range("D2"))

rngOriginC.Worksheet.Activate
rngOriginC.Copy
Sheets("Test").Activate
ActiveSheet.Paste (Sheets("Test").Range("F2"))

rngOriginF.Worksheet.Activate
rngOriginF.Copy
Sheets("Test").Activate
ActiveSheet.Paste (Sheets("Test").Range("H2"))

Application.ScreenUpdating = True

End Sub

___________________________________

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top