ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Repeat Macro (https://www.excelbanter.com/excel-worksheet-functions/51233-repeat-macro.html)

tvkodde26

Repeat Macro
 
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.....

Thanks for any help.

Travis


Ron de Bruin

Repeat Macro
 
Hi tvkodde26

If I understand you correct this will work for you?

Columns("A").NumberFormat = "General"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"tvkodde26" wrote in message oups.com...
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.....

Thanks for any help.

Travis




Bob Phillips

Repeat Macro
 

For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
With Activecell
.Value = .Value
End With
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"tvkodde26" wrote in message
oups.com...
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.....

Thanks for any help.

Travis




Bob Phillips

Repeat Macro
 
Typo

For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
With Cells(i, "A")
.Value = .Value
.NumberFormat = "General"
End With
Next i


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...

For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
With Activecell
.Value = .Value
End With
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"tvkodde26" wrote in message
oups.com...
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.....

Thanks for any help.

Travis






Ron de Bruin

Repeat Macro
 
Bob understand you <g


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi tvkodde26

If I understand you correct this will work for you?

Columns("A").NumberFormat = "General"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"tvkodde26" wrote in message oups.com...
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.....

Thanks for any help.

Travis






Harlan Grove

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)



All times are GMT +1. The time now is 12:01 PM.

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