1
votes

I have a worksheet, on which I am using a macro to create a graph. As the data is scattered across various worksheets in the workbook, I am copying the same and creating a continuous set of columns to use for the creation of the graph:

Sheets("Data1").Range("A29:A39").Copy Destination:=Sheets("Chart").Range("AA29:AA39")
Sheets("Data2").Range("D29:D39").Copy Destination:=Sheets("Chart").Range("AB29:AB39")
Sheets("Data3").Range("I29:I39").Copy Destination:=Sheets("Chart").Range("ACI29:AC39")
Sheets("Data3").Range("D129:D139").Copy Destination:=Sheets("Chart").Range("AD29:AD39")

My data looks like this:

CustomerA            489 456 93%
CustomerB            63  0   0%
CustomerC            123 123 100%
CustomerD            185 172 93%

The above are the values I wish to get in the newly copied cells, not how they were calculated using formulas. I am using the above for this work.

How can I get the absolute values, instead of the relative formulas in my newly copied worksheet cells?

1

1 Answers

3
votes

Use Value like this

Sheets("Chart").Range("AA29:AA39").Value = Sheets("Data1").Range("A29:A39").Value

update: if you are dumping the data into cells that are already formatted as numbers and percentages then this process is cleaner than a copy and paste. If you do need the formats then you could either combine a paste special formtas with the line above or combine our two codes to

  • get the cell formatting indentical between Data1 and Chart
  • dump the values from Data1 to Chart1 replacing the formulae from step 1

    Sheets("Data1").Range("A29:A39").Copy Destination:=Sheets("Chart").Range("AA29:AA39")
    Sheets("Chart").Range("AA29:AA39").Value = Sheets("Data1").Range("A29:A39").Value