Cell value from one workbook to another using string vba

32CARDS

Board Regular
Joined
Jan 1, 2005
Messages
123
I am not sure if this is the correct method, but to avoid copy and paste of cell values from one workbook to another.


WorkBook1 opens Workbook2,
( Workbook2 has Functions etc, but requires data from Workbook1, it does the functions/calculations etc, then I Save and Close Workbook2)

The location of the cell ranges, for simplicity are the same.

So in Workbook1 Sheet1 Cell Range C7 to C19 Values,
require to go to
Workbook2 Sheet1 Cell Range C7 to C19

How would I do this from one Workbook to another without the macro doing a Copy and PasteValues method ?

Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Re: Cell value from one workbook to another using string vba- solved

Code:
Sub Get_reference ()

Sheets("sheet1").Range("C9").FormulaR1C1 = _
"='[workbook2.xlsb]sheet7'!R9C3" 
'I recorded a macro and got that formula, then to remove the formula and retain 'the values I wrote the following code so to have no hard formula reference. 

Sheets("sheet1").Range("C9").Value = Sheets("sheet1").Range("C9").Value
ActiveWorkbook.Save
End Sub
There are several formula, but in essence that's how it worked as far as I know

So I guess it's solved
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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