Changing from formulas to values

kasbac

Active Member
Joined
Jan 2, 2008
Messages
344
Hi there

I have previously gotten some help writing this code which idetifies the last column in a sheet and copy's the formulas found in it to the following coulmn.

Code:
    Sub test()
    Sheets("Overview Q2 2011 (2)").Select
    LastCol = Range("B2").End(xlToRight).Column
    Cells(1, LastCol).EntireColumn.Copy Cells(1, LastCol + 1)
    
    End Sub

I would very much like that in addition to this the macro would after it have transfered the formulas, fix the numbers that are found in the coulmn from which the formula comes.

An example lets say that the formulas are transfered from coulmn B to coulmn C. After the transfer is done I would like for the values in column B to be replaced with values instead of the formulas in the coulmn. Hope that makes sense?

If any clarification is needed please let me know
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try

Code:
Sub test()
Sheets("Overview Q2 2011 (2)").Select
LastCol = Range("B2").End(xlToRight).Column
With Cells(1, LastCol).EntireColumn
    .Copy Cells(1, LastCol + 1)
    .Value = .Value
End With
End Sub
 
Upvote 0
Hi

Code:
Sub test()
    With Sheets("Overview Q2 2011 (2)")
       LastCol = .Range("B2").End(xlToRight).Column
       .Cells(1, LastCol).EntireColumn.Copy .Cells(1, LastCol + 1)
       .Cells(1, LastCol).EntireColumn.Value = .Cells(1, LastCol).EntireColumn..Value
   End With
    
    End Sub
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top