Thread: Repeat Macro
View Single Post
  #6   Report Post  
Harlan Grove
 
Posts: n/a
Default Repeat Macro

tvkodde26 wrote...
I need help in creating a macro that will repeat an easy command. I
have Column A full of numbers, some are formatted General and others
are formatted Text. For Vlookup purposes I need them all formatted as
General.

How would I build a Macro that goes to cell A1 and complete (Enter +
F2) to convert it to general and then it moves to cell A2 and repeats
the same command, etc.....


Formatting doesn't affect contents. Do you mean some of the cells
contain text that looks like numbers and the remaining cells contain
numbers? If so, do you want to permanently convert the cells containing
text into numbers? If so, the simplest way is to select all cells in
col A, run Data Text to Columns, and immediately click the Finish
button.

If you only want lookup formulas to treat all values in col A as
numeric, you could use INDEX/MATCH rather than VLOOKUP. If your
intended formula were =VLOOKUP(x,A1:Z999,y), then use the array formula

=INDEX(A1:Z999,MATCH(x,--A1:A999),y)

If you're using a FALSE or zero 4th argument to VLOOKUP, use a zero 3rd
argument to MATCH in the formula above. Then again, if all values in
your lookup table should be numbers, you could use the array formula

=VLOOKUP(x,--A1:Z999,y)