Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro for copy and paste values
Hi,
I am running the following macro for copying a number derived from a goal seek function and pasting into another worksheet. Dim A As String A = Sheets("Sheets1").Range("A10").Value Sheets("Sheets1").Range("A15").GoalSeek Goal:=A, ChangingCell:=Sheets("Sheets2").Range("D10") The macro works fine and my sheets2.D10 gets a value with 15 decimal places. However, I want it to roundup to 2 decimal places by adding the roundup function in the above macro. How can I do this? A quick help would be greatly appreciated. Many thanks. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro for copy and paste values
Range("D10").NumberFormat = "0.00"
"excelnerd" wrote: Hi, I am running the following macro for copying a number derived from a goal seek function and pasting into another worksheet. Dim A As String A = Sheets("Sheets1").Range("A10").Value Sheets("Sheets1").Range("A15").GoalSeek Goal:=A, ChangingCell:=Sheets("Sheets2").Range("D10") The macro works fine and my sheets2.D10 gets a value with 15 decimal places. However, I want it to roundup to 2 decimal places by adding the roundup function in the above macro. How can I do this? A quick help would be greatly appreciated. Many thanks. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro for copy and paste values
This changes the number format only. But I want the cell itself to contain
only two decimal points. For example, If Cell A * Cell B = Cell C and I want to put a value 1000 to Cell C by changing Cell A. Cell A should contain a number of only two decimal places, not a number like 10.459409908349. Do you think it's possible? "Sean Timmons" wrote: Range("D10").NumberFormat = "0.00" "excelnerd" wrote: Hi, I am running the following macro for copying a number derived from a goal seek function and pasting into another worksheet. Dim A As String A = Sheets("Sheets1").Range("A10").Value Sheets("Sheets1").Range("A15").GoalSeek Goal:=A, ChangingCell:=Sheets("Sheets2").Range("D10") The macro works fine and my sheets2.D10 gets a value with 15 decimal places. However, I want it to roundup to 2 decimal places by adding the roundup function in the above macro. How can I do this? A quick help would be greatly appreciated. Many thanks. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro for copy and paste values
ActiveCell.Value = Application.WorksheetFunction.Round(ActiveCell, 2)
Gord Dibben MS Excel MVP On Sat, 8 Mar 2008 09:31:00 -0800, excelnerd wrote: This changes the number format only. But I want the cell itself to contain only two decimal points. For example, If Cell A * Cell B = Cell C and I want to put a value 1000 to Cell C by changing Cell A. Cell A should contain a number of only two decimal places, not a number like 10.459409908349. Do you think it's possible? "Sean Timmons" wrote: Range("D10").NumberFormat = "0.00" "excelnerd" wrote: Hi, I am running the following macro for copying a number derived from a goal seek function and pasting into another worksheet. Dim A As String A = Sheets("Sheets1").Range("A10").Value Sheets("Sheets1").Range("A15").GoalSeek Goal:=A, ChangingCell:=Sheets("Sheets2").Range("D10") The macro works fine and my sheets2.D10 gets a value with 15 decimal places. However, I want it to roundup to 2 decimal places by adding the roundup function in the above macro. How can I do this? A quick help would be greatly appreciated. Many thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy range in macro using paste special values | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
Macro to open workbook and copy and paste values in to orig workbo | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |