Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA cut and paste bug?
The following code illustrates what looks like a bad bug to me:
Sub CutAndPasteBug() Dim rangeToMove As Range Dim destRange As Range Dim destWS As Worksheet Dim sourceWs As Worksheet Set sourceWs = Sheets("sheet1") Set destWS = Sheets("sheet2") Set rangeToMove = sourceWs.Range("A1") Set destRange = destWS.Range("F5") rangeToMove.Cut destWS.Paste destRange MsgBox rangeToMove.Parent.Name & " " & rangeToMove.Address & _ Chr(13) & Chr(13) & "It should be sheet2!!!!" End Sub The variable rangeToMove should end up referring to sheet2 F5, not sheet1 F5 after the cut is done. The cell address changes from A1 to F5, but the variable is still pointing to sheet1. The entry in sheet 1A1 is moved to sheet2 F5. I've tested this in Excel 97, 2003, and 2007. Am I correct this is a bug, or is it by design? Comments back appreciated! Bob Flanagan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Excel to Word : Paste specialPaste Link Excel Chart Obj doesn't | Charts and Charting in Excel | |||
Paste and Paste Special No Longer Working - Excel 2003 | Excel Discussion (Misc queries) | |||
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. | Excel Worksheet Functions | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) |