Find, Copy, Paste a part of a data row between Excel workbooks

rznfcc

New Member
Joined
Mar 6, 2013
Messages
7
Hi all,
I am very new to macro and VBA writing and see that there are a lot of very talented folks on this board who may be able to help.

I have 2 workbooks I work with daily. One workbook (call it GlobalData) contains global data where any of 50+ fields could have changed each day. The second workbook (call it MyData) contains just those data records that my organization needs to track. I don't have any control over GlobalData but MyData can be modified as needed.

Today, I have to:
1) manually copy a Unique ID from MyData (col P),
2) (F)ind that unique ID in GlobalData (col C)
3) Copy the data from cols A:BC for the record found
4) (P)aste-Special (Values) the data back into Mydata (beginning in col N).

This activity only takes 15 minutes but it has to be done every day.

Can a macro be written to do this? I figured that I would select the unique key in MyData and run the macro to update that record automatically from GlobalData.
 
The Msgbox displayed "37207" which corresponds to the contents of the cell I had selected.
Change this line:
vA = .Range(Cells(fR.Row, "A"), Cells(fR.Row, "BC"))
to this
vA = sS.Range(Cells(fR.Row, "A"), Cells(fR.Row, "BC"))
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Thank you again for you perseverance!

Unfortunately, a new error is presented: Run-time error 1004: Method 'Range' of object '_Worksheet' failed.
 
Upvote 0
Thank you again for you perseverance!

Unfortunately, a new error is presented: Run-time error 1004: Method 'Range' of object '_Worksheet' failed.
Try this replacement:
Code:
With sS
    On Error Resume Next
    Set fR = .Columns("C:C").Find(F.Value, .Cells(1, 1), xlValues, xlWhole, xlByRows, xlNext)
    On Error GoTo 0
    If Not fR Is Nothing Then
        vA = .Range(Cells(fR.Row, "A"), Cells(fR.Row, "BC"))
beginning at the line:
With SS.Columns("C:C")
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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