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,
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,