Copying data to another workbook

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I would like a user to enter data to a workbook without directly accessing
that workbook.

In another workbook I have created in cells a1:f1 I have a formulas that
result in a cell references (these are variable), but for example say A1 =
$BT$150, $BU$150 etc.

I would like the value from cells a2 through f2 to go to Target workbook
$BT$150, $BU$150 etc

Thank you
 
Hi

Assuming that target cells will always be next to each other, this should do
it:

Sub CopyToOtherWB()
Dim TargetWb As Workbook
Dim TargetSh As Worksheet
Dim CopyFrom As Range
Dim DestCell As String
Dim InputSh As Worksheet

Set TargetWb = Workbooks("Book2.xls") ' Change to suit
Set TargetSh = TargetWb.Worksheets("Sheet1")
Set InputSh = ThisWorkbook.Sheets("Sheet1") ' Change to suit
Set CopyFrom = InputSh.Range("A2:F2")

DestCell = InputSh.Range("A1").Value
CopyFrom.Copy Destination:=TargetSh.Range(DestCell)

End Sub

Best regards,
Per
 
Back
Top