Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JohnnyTheAmmer
 
Posts: n/a
Default VBA to Copy Cell Value Without Formula

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default VBA to Copy Cell Value Without Formula

How about:
Sub Macro1()
Dim r1, r2, r3 As Range
Set r1 = Workbooks("Book1").Worksheets("Sheet1").Cells(3, 3)
Set r2 = Workbooks("Book1").Worksheets("Sheet1").Cells(3, 7)
Set r3 = Workbooks("Book2").Worksheets("Sheet1").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 Student


"JohnnyTheAmmer" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
JohnnyTheAmmer
 
Posts: n/a
Default VBA to Copy Cell Value Without Formula

Hi

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

JTH

"Gary''s Student" wrote:

How about:
Sub Macro1()
Dim r1, r2, r3 As Range
Set r1 = Workbooks("Book1").Worksheets("Sheet1").Cells(3, 3)
Set r2 = Workbooks("Book1").Worksheets("Sheet1").Cells(3, 7)
Set r3 = Workbooks("Book2").Worksheets("Sheet1").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 Student


"JohnnyTheAmmer" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dominic LeVasseur
 
Posts: n/a
Default VBA to Copy Cell Value Without Formula

Johnny,

You could use PasteSpecial:Values.

However, I think you could use the formula:

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

HTH

"JohnnyTheAmmer" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Copy exact value from one cell to new formula in another cell asg2307 Excel Discussion (Misc queries) 2 February 6th 06 09:33 PM
How do I copy a formula to another cell cfiser Excel Worksheet Functions 4 January 6th 06 06:35 PM
When I copy down into the next cell the formula changes correctly. Jason30 Excel Discussion (Misc queries) 1 January 12th 05 11:55 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"