Find a value and copy column; paste to next available on another sheet

jrake40

New Member
Joined
Nov 22, 2016
Messages
30
I have three sheets Sheet1 , Sheet2, Sheet3. I would like to create a VBA to do the following:

1. sheet1 A1 is populated with a date.
2. I would like to take Sheet1 A1 and find it on Sheet2 in range B1:O1. Once found copy that column down to last value.
3. Paste the above copied column to sheet3 in the next available blank column.


Thanks in advance for any help.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Practicing my VBA, hope this works:
Code:
Sub findandcopy()
Dim SourceDate As Date
Dim EColumn As Long
Dim Source As Worksheet, Dest As Worksheet, Info As Worksheet
Dim NewData As Range


Set Source = Sheets("Sheet1")
Set Info = Sheets("Sheet2")
Set Dest = Sheets("Sheet3")


SourceDate = Source.Range("A1")


Set NewData = Info.Range("B1:O1").Find(SourceDate)
Set NewData = Info.Range(NewData, NewData.End(xlDown))


EColumn = Dest.Cells(1, Dest.Columns.Count).End(xlToLeft).Column + 1


NewData.Copy Destination:=Dest.Cells(1, EColumn)


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,819
Messages
6,127,047
Members
449,356
Latest member
tstapleton67

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