Problem inserting cut range

I'm trying to cut a range then insert the cut range at a particular location. 
 The code looks like this:

Range("F5:G" & ActiveSheet.UsedRange.Rows.Count).Cut 
Range("D5").Insert(xlShiftToRight)

However, when it reaches this point, I get an error saying "Cut method of 
Range class failed".  I've tried changing the destination range so that it 
reads similar to the origin range, but that didn't help.  Can someone help me 
get the syntax on this line correct?  I've got several similar lines further 
down in the code.  If I can fix this line, I'll be able to fix them all.

Thanks.
0
Utf
2/4/2010 11:29:02 PM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
918 Views

Similar Articles

[PageSpeed] 40

Post the rest of your code so we can help you.  That snipet of code worked 
for me.
-- 
Cheers,
Ryan


"Luke" wrote:

> I'm trying to cut a range then insert the cut range at a particular location. 
>  The code looks like this:
> 
> Range("F5:G" & ActiveSheet.UsedRange.Rows.Count).Cut 
> Range("D5").Insert(xlShiftToRight)
> 
> However, when it reaches this point, I get an error saying "Cut method of 
> Range class failed".  I've tried changing the destination range so that it 
> reads similar to the origin range, but that didn't help.  Can someone help me 
> get the syntax on this line correct?  I've got several similar lines further 
> down in the code.  If I can fix this line, I'll be able to fix them all.
> 
> Thanks.
0
Utf
2/4/2010 11:56:01 PM
I'll have to get it on Monday (Feb 8) since the code's on my machine at work. 
 I copy/pasted the code from my machine to here, however, so it doesn't look 
exactly like it did in the editor.  The code is actually all one line, with a 
space between "Cut" and the second "Range".  If it still works for you as one 
line, I'll post the entire code (that I have so far) on Monday.

Thanks.

"Ryan H" wrote:

> Post the rest of your code so we can help you.  That snipet of code worked 
> for me.
> -- 
> Cheers,
> Ryan
> 
> 
> "Luke" wrote:
> 
> > I'm trying to cut a range then insert the cut range at a particular location. 
> >  The code looks like this:
> > 
> > Range("F5:G" & ActiveSheet.UsedRange.Rows.Count).Cut 
> > Range("D5").Insert(xlShiftToRight)
> > 
> > However, when it reaches this point, I get an error saying "Cut method of 
> > Range class failed".  I've tried changing the destination range so that it 
> > reads similar to the origin range, but that didn't help.  Can someone help me 
> > get the syntax on this line correct?  I've got several similar lines further 
> > down in the code.  If I can fix this line, I'll be able to fix them all.
> > 
> > Thanks.
0
Utf
2/7/2010 5:05:01 AM
Reply:

Similar Artilces:

Having problem of Outlook not receiving new e-mails
I have been using Outlook for over 1 year with Comcast Broadband. Suddenly last week, I received a message that Outlook 2000 was experiencing a problem when receiving new e-mails and was going to shut down. I re-opened Outlook and it looked different and then it asked for me set up a profile and I canceled it. But after that window coming up a couple of times after it shut down, I decided to put in a new name and then I could not get to my old e-mails and it acted like a new set up. Then I really got frustrated. I was eventaully able to get back to my old e-mails and have been able t...

Set a range from a variable location
I am using a loop function that will eventually select and activate a specific cell known as "TheCurrentCell." Once I reach that location I want to use that coordinate as the upper left area of a new range. Supposing that the end cell of my range is D1000, the Range selection would be something like Range(TheCurrentCell:D1000).select, however, I don't know the correct syntax to make this happen. Please help. Thank you. Use something like Range(Selection.Address & ":D1000").Select. "Troubled User" wrote: > I am using a loop function that will...

Insert,Update Data in sage (MS Access Linked tables) using Vb.net form
Hi folks, I am developing application using vb.net which requires integration with SAGE LINE 50 (Accounting software ) V11... The data which SAGE is using is MC ACCESS 2003 database... with linked tables in it... Now I Have developed the Sage connection using ODBC which works fine when reading the record but cannot Add or Update record into the Linked tables.... When i debug the program the error is at the line where it has... <br> MyodbcCommand.ExecutenonQuery() <br> Can anybody Help ????? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/acce...

An Outlook 2003 Problem
I just upgraded from Outlook 97 to Outlook 2003. However, when trying to reply, forward, and compose with Outlook 2003, I got this error message: "The messaging interface has returned an unknown error. If the problem persists, restart Outlook." The problem persisted. I restarted Outlook 2003, but it didn't help. Any suggestions? Thanks. How did you upgrade Outlook 2003 from Outlook 97? Anyway If you use Hotmail or MSN mail, check MSKB info below. You receive a "The messaging interface has returned an unknown error " error message when you try to use Outlook to...

Problems Converting Data from Quicken 2001 Deluxe to MS Money
Hello, I have a relatively new Compaq Desktop (2.5 GHz Celeron with 512 MB RAM). I have a Viewsonic Pocket PC and I wanted to use it to track my financial data so I purchased Money 2003 Standard. I tried several times to convert my Qucken Data (it's a big file--I've been using Quicken since 1995). My Quicken program is Quicken 2001 Deluxe. Anyway, the MS Money program started to convert and after a few minutes said: "Your Quicken file could not be converted. Money could not convert your Quicken file. You might have run out of disk space or system memory. Try closing othe...

Exchange Server 2000 Secuirty Setup problems
Dear I have apply wrong setting to our exchange server 2000 . The wrong setting as from exchange manager . mail store , I have apply everyone send as and receive as access right, the group included remote access via offline sync. This setting once apply , all user access other mailbox without apply access right. I have try disable this setting, after all local office user no problems, but a remote offline sync laptop user does not work . The error as below: Unable to display the folder. Microsoft Outlook could not access the specified folder location. The file C:\exchange\shawnb.ost cannot b...

CRM 4.0 Custom Report Filter Problem
I am using the Report Wizard to create a simple report. Report is using Quotes and Quote Products I have a custom field in Quote Products which is a bit field Yes-No When I use that field as a filter for report output, I get all records. The filter criteria appears to be ignored Is this an inherent problem with Report Wizard or Am I doing something wrong? Thanks. depends on your business logic and what you want to see. If you have three quotes: Quote-1 has three products, all with the custom field set to Yes Q2 has three products, two set to Yes, 1 to No Q3 has three products, all set...

Help! Problem Referencing Excel 2003 in VB.NET
I am using Visual Studio 2008 Express Edition to develop some VB.NET code that manipulates Excel files. I am developing on a Vista/Excel 2007 machine, but I need the code to work on an XP/2003 machine as well. I initially set a reference to the Microsoft Excel 12.0 Object Library and imported the Microsoft.Office.Interop.Excel namespace. This works great on the VIsta/Excel 2007 machine, but it does not work on 2003, which needs the 11.0 library. I get an error that says "Unhandled Exception . . . Could not file or assembly 'Microsoft.Office.Interop.Excel, Version 12.0.0....

Duplicate personal folders problem
Hello all, I have a problem with Outlook 2003 and I hope someone can help me resolve it I imported a PST file from Outlook XP that was on a different machine, and now I have two versions of Personal Folders in my All Mail Folders list. They both have Deleted Items, Drafts, Inbox, Junk E-mail, Outbox, Sent Items and Search Folders in. One of them has an icon of a piece of paper with a clock to the top left and a house to the top right. The other one has an icon like a stack of files (like from a filing cabinet) They are clearly referencing the same thing, as the Deleted Items both have al...

Interesting Solver problem (Solver encounters an error)
Here's an interesting problem, I wonder if anyone has any thoughts o this. Recognize that my real problem is very complex (severa intermediate calculation including some iterative steps), but th problem I'm having seems similar (conceptually anyway) to this simpl problem. Given a data set: x,y 10,3.9 8,3.2 7,2.8 6,2.2 5,1.4 4.5,0.8 4,0.01 3.8,-0.4 3.6,-1 3.5,-1.4 3.4,-1.8 3.3,-2.4 3.2,-3.2 3.1,-4.6 3.05,-6 One could look at the data and say, "that looks like the curve y=ln(x) but with a different asymptote other than the y-axis and possibly scaling factor." So we choos...

Excel Problem #3
I have win2000 with Office 2000 in the network! When i try to rename one excel file my computer make restart. This hapening not to all files,and all files there are in the same folder in the network! What hapen,and what i can do so as to work out the problem? I have all the required permissions on that network folder. No one else has any of the files open. They are not shared workbooks. ...

re post range check
hi i have a worksheet with a lot of data on it column A contains the date column B contains an area column C contains the fault column D contain a quantity A B C D 1/4/04 stores damaged 10 7/4/04 bins rust 60 -- -- --- -- -- --- - -- -- 31-12-04 floor ...

Problems with MFC list controls
I have a large list control with many inventory control items displayed within. When someone single clicks on an item, it displays information about that item in another part of the dialog. I have a three-fold problem, the master list has multiple columns in it, in order to make the selection work properly, only column 0 can be selected, is there a way to make a valid row selection if you select an item using any of the other columns? Second issue is the highlight of the selection. Only column 0 in the list control will highlight, is there a way to make the entire row highlight when an...

Next button problems
I have a next button in a form that I have criteria for. I have a date field that has to be entered before going to another record. When I click the next button I get the pop up that says click update to continue but the form displays the next record instead of staying on the current record that needs updating. Here is the code that I am using. ____________________________________________________________________________________ Private Sub Command39_Click() If IsNull([Post Called Customer]) Then MsgBox "You must click the UPDATE button to continue!!!" Cancel = True End If On Erro...

Problem with message routing between EXCH2K and EX2K3
We are running a ver simply Exchange topology, with an Exchange 2000 single server (ServerA) acting as "dumb" Information Store. Incoming and outbound SMTP email is relayed through a Linux based SMTP host relay on the same subnet, which handles all domain lookups for mail routing. ServerA is configured to use to the Linux SMTP server as it's smart host. The domain is a native Windows 2003 AD topology. My problem is the following: I have recently added a new Exchange 2003 Server (ServerB) into our Exchange site topology. If I create a user (UserA) on ServerA and then do a...

Changing named range reference depending on a cell's content
Where to start?! I've got the following formula pulling data in from a secon spreadsheet within the same workbook: =IF($I$7="MICH",INDEX(MICH,MATCH($D7,LOB,0),MATCH($F$5,Month,0)),0) We have 8 different locations ("MICH" being one of them) that we nee to be able to access. I can write a nested IF formula that looks a cell I7 (that contains a list of all 8 locations) and, depending o I7's content, brings back the desired values. I was hoping someone in the forum could help me write a simpler formul that would not have 7 IF statements embedded in it. Any help w...

Problem inserting cut range
I'm trying to cut a range then insert the cut range at a particular location. The code looks like this: Range("F5:G" & ActiveSheet.UsedRange.Rows.Count).Cut Range("D5").Insert(xlShiftToRight) However, when it reaches this point, I get an error saying "Cut method of Range class failed". I've tried changing the destination range so that it reads similar to the origin range, but that didn't help. Can someone help me get the syntax on this line correct? I've got several similar lines further down in the code. If I can fix thi...

Visio Printing Problem
I am trying to print a flowchart. The print view displays the complet flowchart. However, when I print the flowchart, the top half of th flowchart is omitted and the bottom half prints. Any problem solvin recommendations would be appreciated -- jqsandma ----------------------------------------------------------------------- jqsandman's Profile: http://www.officehelp.in/member.php?userid=661 View this thread: http://www.officehelp.in/showthread.php?t=136719 Posted from - http://www.officehelp.i this usually ends up as being "apply available software patches to visio" or &quo...

insert text to different pages and update
Is there a way to insert a text cell from one page put into another page and when the first page cell is updated the second page cell will also be updated. Using the = sign just displays the formula, not the text. :confused: Thanks Frank -- fwburkey ------------------------------------------------------------------------ fwburkey's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30314 View this thread: http://www.excelforum.com/showthread.php?threadid=505331 Not clear what you are doing wrong. the formula should look lik =Sheet1!A1 Make sure there is noth...

Attachment problems
Hi, Is there anyway to unlock outlook 2002's block on ".exe" files. I know these are Level1 blocks, but can't find a way to configure it. I have recieved an important program and need to run it. Thanks in advance Scott Try here: Opening .exe Attachments with the Outlook E-mail Security Update and Outlook 2002 http://www.slipstick.com/outlook/esecup/getexe.htm -- Nikki Peterson [MVP - Outlook] "Scott White" <ddltrade@hotmail.com> wrote in message news:OmVN4JVnDHA.1672@TK2MSFTNGP09.phx.gbl... Hi, Is there anyway to unlock outlook 2002's block on...

Compare each value in a range to each value in another range
I am looking for a macro that will return a comparison of each cell in a range to each cell in another range. example. the first range would have vales of 1,2,3 and the second range would have values of 5,6,7 Thus the macro should return 9 possible comparisons: 1 & 5, 1 & 6, 1 & 7, 2 & 5, 2 & 6, 2 & 7, 3 & 5, 3 & 6, 3 & 7, Can anybody help me with this?? Just hazarding some thoughts here .. Perhaps using formulas would suffice ? Example: Assume 1st range is A1:A3, 2nd range is B1:B3. Then Compare 1st range against 2nd range I...

Range Names with Charts
I would like to use rangenames to specify the data sources for a chart, but Excel does not seem to like this. I have tried entering the rangename in the following formats: rangename =rangename ={rangename] ={"rangename"} .... and various other formats. Surely there is a way to do this ....? Art Hi, try either depending on whether the named range is local to the sheet. =sheetname!rangename =bookname.xls!rangename cheers Andy ArthurJ wrote: > I would like to use rangenames to specify the data sources for a chart, but > Excel does not seem to like this. I have tried en...

A Strange Printing Problem
Our accounting department maintains an Excel file, updated in an onging process, converted to a PDF at month close, and distributed to our senior management. There are nine worksheets, seven behave normally, but two worksheets default to printing 2 copies. No macros, viruses, etc. Any suggestions on a fix will be appreciated. Paul I would try a different PDF converter. There are a # of free ones out there. It would be a simple and quick test to see if that was the problem. "PA" wrote: > Our accounting department maintains an Excel file, updated in an onging > process,...

Ipaq
A user where I work has had problems with his Ipaq serial connection 'going to sleep' over the last couple of weeks. Here are some further details: It's an Ipaq 3890 using ActiveSync 3.7 on a Windows NT4 workstation running Office 97. He synchronises mail of approx 1.5g , which includes Office attachments. The PDA has been working fine for over a year on ActiveSync 3.5, and there has been no software upgrades or changes on the users PC. There are no error reports in any way, and nothing is shown in the event viewer. I have already tried the following: Reinstalled ActiveSync 3.5 R...

MFC #define Problem
We've been using Visual C++ for at least two versions (VC++ 6.0, VC++ 7.0 .NET), but now we've upgraded to .NET 7.1.3088 and found that a macro define in shlobj.h includes the symbol NUM_POINTS. This generic name conflicts with a const declaration within the scope of a source file. Has anybody encountered this error? ...