A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

switch 2 cells around



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2004, 04:57 PM
whitedevil
external usenet poster
 
Posts: n/a
Default switch 2 cells around

Is there a way to switch two cells around? Copy something from cell A to
cell B and from B to A without using any extra empty cells. Maybe using
some function?

Thanks,


---
Message posted from http://www.ExcelForum.com/

  #2  
Old July 2nd, 2004, 05:46 PM
AlfD
external usenet poster
 
Posts: n/a
Default switch 2 cells around

Hi!

Not to my knowledge.
VBA could do it: sample swap of ranges below:

Sub Swap(a As Range, b As Range)
If a.Count b.Count Then Exit Sub
If a.Rows.Count b.Rows.Count Then Exit Sub

Dim c As Variant
c = a.Formula
a.Formula = b.Formula
b.Formula = c

End Sub

Could be called by a commandbutton which connected to a sub like

Private Sub CommandButton1_Click()
Swap Range("E4:E7"), Range("F4:F7")
End Sub

In this configuration, it would of course toggle the two ranges.

Alf


---
Message posted from http://www.ExcelForum.com/

  #3  
Old July 2nd, 2004, 05:52 PM
whitedevil
external usenet poster
 
Posts: n/a
Default switch 2 cells around

wow, ok thank you, i'll try that


---
Message posted from http://www.ExcelForum.com/

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't copy cells to new workbook Lee Jeffery New Users 1 June 22nd, 2004 12:02 PM
averaging linked cells Peo Sjoblom Worksheet Functions 0 June 1st, 2004 07:35 PM
Slanting Cells in first Row Worksheet Functions 14 February 27th, 2004 06:47 PM
Locking other cells based on values in a cell Worksheet Functions 3 January 13th, 2004 12:53 AM
Counting Unique entries in a list eliminating Blanks and Merged Cells Harlan Grove Worksheet Functions 0 December 8th, 2003 11:34 PM


All times are GMT +1. The time now is 02:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.