Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
Cooking Tips
ExcelTips (menu)
ExcelTips (ribbon)
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
School Tips
Wedding Tips
WordTips (menu)
WordTips (ribbon)
Advertise on the
ExcelTips Site
Automatically Protecting After Input
Sorting Data on Protected Worksheets
Understanding Manual Calculation
Using Color in Headers and Footers
If you do any serious macro programming, there will eventually come a time when you want to swap the values in two strings. In some versions of BASIC, there are commands that handle this. VBA leaves us to our own devices, however. The following technique should do the trick for most people:
TempString = MyString1 MyString1 = MyString2 MyString2 = TempString
When completed, the values in MyString1 and MyString2 have been swapped, and TempString doesn't matter, since it was intended (by this technique) as a temporary variable anyway.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2349) applies to Microsoft Excel versions: 97 2000 2002 2003 2007
Remove Some Stress at Tax Time! Doing your personal income taxes can be a royal pain. Why not make the process just a bit less stressful with our 101-question checklist. You can prepare for filing your taxes with confidence, knowing you've covered all your bases.