Importing data from another spreadsheet as a value

DejaVue96

New Member
Joined
Nov 5, 2010
Messages
3
Hello all, I have a macro that I use to import cells and ranges from another sheet into my current one, but instead of importing the formula, I would like only the value. I cannot get the syntax right for VALUE to work. Here is my present macro:


Sub test()

Dim wksDest As Worksheet
Dim MyPath As String
Dim MyFile As String

Application.ScreenUpdating = False

Set wksDest = ActiveWorkbook.ActiveSheet

MyPath = "\\SynServerDV\Managers\Managers\"
MyFile = "Wednesday.xls"

Workbooks.Open Filename:=MyPath & MyFile, Password:="XXXXX"
Worksheets("Main").Range("E4:I24").Copy Destination:=wksDest.Range("E22")
Worksheets("Main").Range("J26").Copy Destination:=wksDest.Range("I44")
ActiveWorkbook.Close savechanges:=False

Application.ScreenUpdating = True

End Sub


E4 to I24 are numbers so those work, but J26 is a SUM formula and instead of the sum, I get the formula imported. I know VALUE is what I need to use, but any way I set t up it gives me an error. Any help would be appreciated.

Tony
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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