-
New to Excel Macros and need some hlep
Hi guys,
I need to develop an Excel Macro that will insert the correct country code for a list of phone numbers.
I'm thinking I'll have a prompt, something like "Enter Country Code:" where the user would enter the code and then it would be added to all phone numbers in the list. Eg. For a list of Turkish phone numbers I'd enter 90, and the list of phone numbers would have +90 added to them.
The trouble is I have no Idea where to start as I haven't had experience with Excel Macros before.
Note, this isn't just a script request because I actually like to learn how to do this sort of thing so if someone could guide me through the development of this macro that would be great.
Thanks in advance.
-
For a simple method, your macro could use the Selection object to determin if anything has been selected for updating. If there is anything there then use the builtin InputBox function to pop open a messagebox that asks for the country code. Once you have the country code you would then loop through the selection objects cells and update those items with the country code.
If you have not worked with Excel Macros before, I suggest that you find something very simple that you want to do, then turn on the macro recorder, do the steps you want, then stop the macro recorder. Save the new macro and then look at what Excel created in the VBA Editor. Once you do a few of these, and see how Excel does the work, you will then feel more comfortable creating your own macros.
Maybe start super simple and just add a country code to the currently active cell. Don't even ask for which code just use +90 to start. Once you get that to work then you can add in the InputBox() function to ask for the code. Then once you get that to work then you can add the looping code to loop through the selection object. Basically get one thing to work at a time, until you can do it all.
Good Luck!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks