Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / September 2007

Tip: Looking for answers? Try searching our database.

Repeat a Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Victoria - 25 Sep 2007 17:45 GMT
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 - 25 Sep 2007 19:11 GMT
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
> Hello-
>
[quoted text clipped - 17 lines]
>
> Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.