ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Bob Phillips followup question on text macro (https://www.excelbanter.com/excel-discussion-misc-queries/32648-bob-phillips-followup-question-text-macro.html)

kayabob

Bob Phillips followup question on text macro
 
Bob,
You gave me this wonderful macro last week, which has helped our group more
than you can know. I am wondering if there is any way to make this macro
relative, so that I dont have to go into the macro manually and change the
column reference when my data is in a different column than A. I'd like to
be able to click at the top of any column and have the macro run down that
current column

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = "'0" & Cells(i,"A").VAlue
Next i

Thanks for your help

Bob Phillips

That's good to hear it is being so useful.

To answer your question, this should work on any cell in the column, not
just the top cell

iLastRow = Cells(Rows.Count,Activecell.Column).End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = "'0" & Cells(i,Activecell.Column).VAlue
Next i


--
HTH

Bob Phillips

"kayabob" wrote in message
...
Bob,
You gave me this wonderful macro last week, which has helped our group

more
than you can know. I am wondering if there is any way to make this macro
relative, so that I dont have to go into the macro manually and change the
column reference when my data is in a different column than A. I'd like

to
be able to click at the top of any column and have the macro run down that
current column

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = "'0" & Cells(i,"A").VAlue
Next i

Thanks for your help




kayabob

Thanks! Exactly what i needed! Even more time saved for us.

"Bob Phillips" wrote:

That's good to hear it is being so useful.

To answer your question, this should work on any cell in the column, not
just the top cell

iLastRow = Cells(Rows.Count,Activecell.Column).End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = "'0" & Cells(i,Activecell.Column).VAlue
Next i


--
HTH

Bob Phillips

"kayabob" wrote in message
...
Bob,
You gave me this wonderful macro last week, which has helped our group

more
than you can know. I am wondering if there is any way to make this macro
relative, so that I dont have to go into the macro manually and change the
column reference when my data is in a different column than A. I'd like

to
be able to click at the top of any column and have the macro run down that
current column

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = "'0" & Cells(i,"A").VAlue
Next i

Thanks for your help






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

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