close

Hi

I have 2 workbooks, 1 contains a sheet that has a formula in cell C3 and C7,
this does a countif if function to give me figures, the other workbook
contains data for a whole year, in this book I have a cell that requires the
sum total of both cells from the 1st workbook, i.e C3 = 3, C7=7 so cell C3 in
the other workbook needs to read 10, I have tried using a seperate cell to do
the calculation and then copy the total across but it just gives me 'REF#'
Is there a way of copying accross without taking the Formula with it, ie
just the number in the cell???

Cheers

JTH

How about:
Sub Macro1()
Dim r1, r2, r3 As Range
Set r1 = Workbooks(quot;Book1quot;).Worksheets(quot;Sheet1quot;).Cells(3, 3)
Set r2 = Workbooks(quot;Book1quot;).Worksheets(quot;Sheet1quot;).Cells(3, 7)
Set r3 = Workbooks(quot;Book2quot;).Worksheets(quot;Sheet1quot;).Cells(3, 3)
r3.Value = r2.Value r1.Value
End Sub

If all you need is the value, you don't need Copy/Paste

--
Gary''s Studentquot;JohnnyTheAmmerquot; wrote:

gt; Hi
gt;
gt; I have 2 workbooks, 1 contains a sheet that has a formula in cell C3 and C7,
gt; this does a countif if function to give me figures, the other workbook
gt; contains data for a whole year, in this book I have a cell that requires the
gt; sum total of both cells from the 1st workbook, i.e C3 = 3, C7=7 so cell C3 in
gt; the other workbook needs to read 10, I have tried using a seperate cell to do
gt; the calculation and then copy the total across but it just gives me 'REF#'
gt; Is there a way of copying accross without taking the Formula with it, ie
gt; just the number in the cell???
gt;
gt; Cheers
gt;
gt; JTH

Hi

Thanks for the prompt reply, I will give that a go and let you know if it
works for me

JTH

quot;Gary''s Studentquot; wrote:

gt; How about:
gt; Sub Macro1()
gt; Dim r1, r2, r3 As Range
gt; Set r1 = Workbooks(quot;Book1quot;).Worksheets(quot;Sheet1quot;).Cells(3, 3)
gt; Set r2 = Workbooks(quot;Book1quot;).Worksheets(quot;Sheet1quot;).Cells(3, 7)
gt; Set r3 = Workbooks(quot;Book2quot;).Worksheets(quot;Sheet1quot;).Cells(3, 3)
gt; r3.Value = r2.Value r1.Value
gt; End Sub
gt;
gt; If all you need is the value, you don't need Copy/Paste
gt;
gt; --
gt; Gary''s Student
gt;
gt;
gt; quot;JohnnyTheAmmerquot; wrote:
gt;
gt; gt; Hi
gt; gt;
gt; gt; I have 2 workbooks, 1 contains a sheet that has a formula in cell C3 and C7,
gt; gt; this does a countif if function to give me figures, the other workbook
gt; gt; contains data for a whole year, in this book I have a cell that requires the
gt; gt; sum total of both cells from the 1st workbook, i.e C3 = 3, C7=7 so cell C3 in
gt; gt; the other workbook needs to read 10, I have tried using a seperate cell to do
gt; gt; the calculation and then copy the total across but it just gives me 'REF#'
gt; gt; Is there a way of copying accross without taking the Formula with it, ie
gt; gt; just the number in the cell???
gt; gt;
gt; gt; Cheers
gt; gt;
gt; gt; JTH

Johnny,

You could use PasteSpecial:Values.

However, I think you could use the formula:

='FullPath[FileName]Sheet1'!C3 'FullPath[FileName]Sheet1'!C7

HTH

quot;JohnnyTheAmmerquot; wrote:

gt; Hi
gt;
gt; I have 2 workbooks, 1 contains a sheet that has a formula in cell C3 and C7,
gt; this does a countif if function to give me figures, the other workbook
gt; contains data for a whole year, in this book I have a cell that requires the
gt; sum total of both cells from the 1st workbook, i.e C3 = 3, C7=7 so cell C3 in
gt; the other workbook needs to read 10, I have tried using a seperate cell to do
gt; the calculation and then copy the total across but it just gives me 'REF#'
gt; Is there a way of copying accross without taking the Formula with it, ie
gt; just the number in the cell???
gt;
gt; Cheers
gt;
gt; JTH

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()