?
Solved

Excel 2010 VBA - convert formula in a cell into the value of that formula.

Posted on 2014-01-12
3
Medium Priority
?
838 Views
Last Modified: 2014-01-12
I would like to have VBA code do the following:
1.  edit the current cell (F2).
2.  turn the formula inside that cell into the final value (press F9)
3.  move down to next cell.
4.  If the next cell is empty.  end execution of macro.
0
Comment
Question by:brothertruffle880
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39774592
Does this have to be like that?

You can do it without a macro using copy/paste-values.

If if has to be a macro you can have something like

Sub cnv2values()
dim rng as range
set rng=range(selection,selection.end(xldown))
rng.value=rng.value
end sub
0
 

Author Comment

by:brothertruffle880
ID: 39774611
Thanks!

How would I add:

Selection.Hyperlinks.Delete

to your code?

I would like the hyper links to be removed from the cells also.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 39774616
Try

Sub cnv2values()
dim rng as range
set rng=range(selection,selection.end(xldown))
rng.value=rng.value
rng.hyperlink.delete
end sub
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question