# Excel Macro that does "F2 and Enter" for a range of cells



## mon645

Hi, I have a column in Excel that consists with time (minutes) from 0 to 80. I need a macro that will take each cell within a range (let say a column A1 to A6000) and do F2 and enter to each of the cells. I have too many cells to do it manualy..F2=>Enter. My lookup wont recognize the numbers unless I do so. Can you help?

Thanks


----------



## Jimmy the Hand

Hi 

This macro does what you asked for:


Code:


Sub test2()
    Dim c As Range
    For Each c In Range("A1:A6000").Cells
        c.Select
        SendKeys "{F2}", True
        SendKeys "{ENTER}", True
    Next
End Sub

However, I think there might be other solutions, quicker and/or simpler ones. To be more specific, I suspect this to be a cell formatting issue. But without a closer look I can't tell.

Jimmy


----------



## Zack Barresse

Eww, ugly, no, yuck, wrong! Try _Text to Columns_. Next time you post for help, post what your problem is, not what you want as a solution. We keep learning much more open this way (for all of us).


----------



## BAD-DADDY

Jimmy,

This does EXACTLY what I needed. Many thanks and best regards.

Roger


----------



## Aj_old

mon645 said:


> Hi, I have a column in Excel that consists with time (minutes) from 0 to 80. I need a macro that will take each cell within a range (let say a column A1 to A6000) and do F2 and enter to each of the cells. I have too many cells to do it manualy..F2=>Enter. My lookup wont recognize the numbers unless I do so. Can you help?
> 
> Thanks


If all your cells consist of numbers stored as text you could do one of this:
add a new column, and write this formula:


Code:


 =A1+0

or


Code:


 = Value(A1)

and copy it for all cells in column A and use this column for calculations or just copy and paste special, value only, on column A , and work with column A

The second solution is to select the cells that contain numbers stored as text, select all of them and in the first cell you'll have on the right side an exclamation sign, click on it and select Convert to number! This way you'll have all your cells that contains numbers converted to numbers!


----------

