write marco to put data from sheet to memory

  • Thread starter Thread starter Desmond Leung
  • Start date Start date
D

Desmond Leung

Hi, I would like to write macro or dll
to copy a range of data from excel sheets to
memory so that I can recall these data from
other books or macros.
can anybody help me? Thanks
 
if you declare your variables as Public, they are
available so be used in other routines...


Option Explicit
Public Temp As Variant
Sub Main()
Call subFirst
Call subSecond
End Sub
Sub subFirst()
Dim x
x = Workbooks("Book1").Sheets("Sheet1").Range("A1:C7")
Temp = Workbooks("Book1").Sheets("Sheet1").Range
("A1:C7")
End Sub
Sub subSecond()
Workbooks("Book2").Sheets("Sheet1").Range("A1:C7") =
Temp
End Sub


Patrick Molloy
Microsoft Excel MVP
 
Hi, I tried to use these code, However, I need the
variable that can be
shared among different modules and different workbooks.
e.g, I have
written an addin workbook : addin.xla and I declared an
array called
arr1() as double.
then I use this array in other sheet to copy the values
into this array
from another workbook book1,xls and I find that it doesn't
work.

may you help me again? thanks


Desmond
 
Hi, I tried to use these code, However, I need the variable that can be
shared among different modules and different workbooks. e.g, I have
written an addin workbook : addin.xla and I declared an array called
arr1() as double.
then I use this array in other sheet to copy the values into this array
from another workbook book1,xls and I find that it doesn't work.

may you help me again? thanks


Desmond
 
Back
Top