ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   add leading character (https://www.excelbanter.com/excel-discussion-misc-queries/171492-add-leading-character.html)

Satnam Randhawa[_2_]

add leading character
 
I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?

Gary''s Student

add leading character
 
Select the cells you want to process and run this:

Sub quote_me()
apos = Chr(39)
For Each r In Selection
r.Value = apos & r.Text
Next
End Sub

--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?


Satnam Randhawa[_2_]

add leading character
 
doesnt work...
any other suggestions?

"Gary''s Student" wrote:

Select the cells you want to process and run this:

Sub quote_me()
apos = Chr(39)
For Each r In Selection
r.Value = apos & r.Text
Next
End Sub

--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?


Gary''s Student

add leading character
 
Make sure you run it from the worksheet and select the cells first
--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

doesnt work...
any other suggestions?

"Gary''s Student" wrote:

Select the cells you want to process and run this:

Sub quote_me()
apos = Chr(39)
For Each r In Selection
r.Value = apos & r.Text
Next
End Sub

--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?


Satnam Randhawa[_2_]

add leading character
 
I have selected the cells but its showing an error in the code when i try to
write it in the macro..

"Gary''s Student" wrote:

Make sure you run it from the worksheet and select the cells first
--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

doesnt work...
any other suggestions?

"Gary''s Student" wrote:

Select the cells you want to process and run this:

Sub quote_me()
apos = Chr(39)
For Each r In Selection
r.Value = apos & r.Text
Next
End Sub

--
Gary''s Student - gsnu200763


"Satnam Randhawa" wrote:

I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?


L. Howard Kittle

add leading character
 
Maybe you need to declare the variables.

Sub quote_me()
Dim apos As Variant
Dim r As Variant
apos = Chr(39)
For Each r In Selection
r.Value = apos & r.Text
Next
End Sub

HTH
Regards,
Howard

"Satnam Randhawa" wrote in
message ...
I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?




dave m

add leading character
 
Hello there.

Why not use something simple like:
In a cell next to the top piece of data type a space and apostrophe.
Then in an empty cell on the same line use =right(a1,1) & a2
where A1 is the cell with the apostrophe and a2 is the cell with your number .
Once done rip it down as far as you want.
If needed highlight new column of data and copy- Paste special values over
the top of your formulas to hard case them in.

Dave

"Satnam Randhawa" wrote:

I have a column of numbers to which I want to add a leading apostrophe. how
do i do it in one go?



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

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