Excel 2007 user - Data entry from Source workbook to Destination workbook

MonsterBait

New Member
Joined
May 17, 2012
Messages
10
Hello,

My first post, forgive me if I'm not following posting ettique/rule 100%.

I have VBA code which allows me to enter data from Sheet1 to Sheet2 on the same Workbook.

I need help to change the code which will allow me to enter data from Sheet1 in Workbook1 to Sheet1 in Workbook2.

I'm stuck on the code to activate Workbook2. I'll be grateful for any assistance. (I'm also a newbie to VBA coding.)

This works on the same Workbook:

'Pick the next Blank Space

Set CurRange = Range("RecordAddress")
If CurRange.Value <> "" Then
If CurRange.Offset(1, 0) <> "" Then Set CurRange = CurRange.End(xlDown)
Set CurRange = CurRange.Offset(1, 0)
End If

'Add New Details

With CurRange
For Num1 = 0 To UBound(EntryCells)
.Offset(0, Num1).Value = Range(EntryCells(Num1)).Value
Next Num1
End With

This doesn't work when I try to use multiple worbooks:

'Pick the next Blank Space

Workbooks("Book2.xlsx").Activate
Set CurRange = Workbooks("Book2.xlsx").Range("RecordAddress")
If CurRange.Value <> "" Then
If CurRange.Offset(1, 0) <> "" Then Set CurRange = CurRange.End(xlDown)
Set CurRange = CurRange.Offset(1, 0)
End If

'Add New Details

With CurRange
For Num1 = 0 To UBound(EntryCells)
.Offset(0, Num1).Value = Range(EntryCells(Num1)).Value
Next Num1
End With


Regards,
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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