Change a value for a link to another Excel file

I do not know much about Visual Basic and maybe somebody know how to change the value 100,200,50,75 by a link to another excel document

Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer

A = 100
B = 200
C = 50
D = 75


ActiveSheet.Shapes.AddShape(msoShapeRectangle, A, B, C, D). _
Select
Range("B2").Select
End Sub




Answer this question

Change a value for a link to another Excel file

  • Jim Wooley

    Tanks a lot

  • Irfon Subhan

    Create a workbook called 'Shapedata.xls' and enter values in A1:D1, then insert this code:

    Dim dataWB As Workbook

    Set dataWB = Workbooks.Open("c:\documents\shapedata.xls") 'change to correct path

    A = dataWB.Worksheets("sheet1").Range("a1").Value
    B = dataWB.Worksheets("sheet1").Range("b1").Value
    C = dataWB.Worksheets("sheet1").Range("c1").Value
    D = dataWB.Worksheets("sheet1").Range("d1").Value

    dataWB.Close
    Set dataWB = Nothing

  • Change a value for a link to another Excel file