Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CDB CDB is offline
external usenet poster
 
Posts: 4
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Looping David T Excel Discussion (Misc queries) 2 August 30th 06 10:51 PM
Looping [email protected] Excel Programming 0 October 31st 03 07:47 PM


All times are GMT +1. The time now is 01:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"