ExcelBanter

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

Victoria[_3_]

Repeat a Macro
 
Hello-

I am a newbie here and at a very basic level of visual basic. What I
am trying to accomplish is to remove the formatting of a phone number
and I am trying to remove the first bracket around the area code of a
phone number. What I want to do is create a macro that would repeat
the following function:

Range("Y2").Select
ActiveCell.FormulaR1C1 = "9543/814-254666"
With ActiveCell.Characters(Start:=1, Length:=15)
End With

However, for the active cell the data will be different for each
active cell and not what is listed above ("9543/814-25466").

Can anyone help on 1) how to create the macro so it repeats the
functionality and 2) how to state that the active cell could have any
data in it but would need?

Thank you.


Trevor Shuttleworth

Repeat a Macro
 
Might be easier if you told us what the data looks like before the macro is
run and how you want it to look afterwards ... content and format.

See if this helps:

With Selection
' remove first character
.Value = Right(.Value, Len(.Value) - 1)
' remove format
.Interior.ColorIndex = xlNone
End With

Regards

Trevor


Regards
"Victoria" wrote in message
oups.com...
Hello-

I am a newbie here and at a very basic level of visual basic. What I
am trying to accomplish is to remove the formatting of a phone number
and I am trying to remove the first bracket around the area code of a
phone number. What I want to do is create a macro that would repeat
the following function:

Range("Y2").Select
ActiveCell.FormulaR1C1 = "9543/814-254666"
With ActiveCell.Characters(Start:=1, Length:=15)
End With

However, for the active cell the data will be different for each
active cell and not what is listed above ("9543/814-25466").

Can anyone help on 1) how to create the macro so it repeats the
functionality and 2) how to state that the active cell could have any
data in it but would need?

Thank you.





All times are GMT +1. The time now is 08:22 AM.

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