ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through the F2 command (https://www.excelbanter.com/excel-programming/287996-looping-through-f2-command.html)

CDB

Looping through the F2 command
 
I am currently using Microsoft 2000 and as part of my job
I need to download figures into a spreadsheet and do
analysis on these figures. The problem is that when I
download the figures they must get imported as text, ans
they are not recognised until I go through each cell
pressing the F2 key. I can have thousands of rows at a
time, so this can take quite long.

Is there any code I can use to just set up a macro to loop
through the cells with data in and press the F2 key?

Chip Pearson

Looping through the F2 command
 
Try code like the following:

Dim Rng As Range
For Each Rng In Selection.Cells
Rng.Value = Rng.Value
Next Rng

Select the cells containing the data, then run the code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"CDB" wrote in message
...
I am currently using Microsoft 2000 and as part of my job
I need to download figures into a spreadsheet and do
analysis on these figures. The problem is that when I
download the figures they must get imported as text, ans
they are not recognised until I go through each cell
pressing the F2 key. I can have thousands of rows at a
time, so this can take quite long.

Is there any code I can use to just set up a macro to loop
through the cells with data in and press the F2 key?




Frank Kabel

Looping through the F2 command
 
Hi

Sub F2_update()
Dim c As Range

For Each c In Selection
SendKeys "{F2}", True
SendKeys "{ENTER}", True
Next c
End Sub

Just highlight the rows/columns you want to process and start this
macro
Frank



Tom Ogilvy

Looping through the F2 command
 
if the values are numbers, you can format the column as Number under
format=Cells, number tab.

then select a blank cell and do edit copy. Select the cells in the column
and do Edit=PasteSpecial and select Values and Add. This should have the
same effect as selecting each cell and editing it. An alternative is to
select the column and do Data=Text to columns and in the wizard, select
delimited, then select a delimiter that does not appear in the entries.
This should also cause Excel to reevaluate the values in the cells and store
them as numbers.

A macro (select the cells you want converted)

Sub Convert()
Dim cell as Range
selection.Numberformat = "#,##0.00"
for each cell in selection.SpecialCells(xlConstants, xlTextValues)
cell.Formula = cell.Value
Next
selection.Numberformat = "General"
End Sub


--
Regards,
Tom Ogilvy


"CDB" wrote in message
...
I am currently using Microsoft 2000 and as part of my job
I need to download figures into a spreadsheet and do
analysis on these figures. The problem is that when I
download the figures they must get imported as text, ans
they are not recognised until I go through each cell
pressing the F2 key. I can have thousands of rows at a
time, so this can take quite long.

Is there any code I can use to just set up a macro to loop
through the cells with data in and press the F2 key?





All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com