LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel VBA coding problem

I need to solve a macro problem ASAP. It involves problems with Excel VBA
skipping over the whole rest of a Subroutine right when I try to paste a
range (the copy/cut works fine, I believe). Code examples are below.

Here's an excerpt where the problem occurs:
With Workbooks("Benefits.xlsm").Worksheets(strMainSheet )
intLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
intLastCol = .Cells.SpecialCells(xlCellTypeLastCell).Column
..Range(.Cells(1, 1), .Cells(intLastRow, intLastCol)).Cut
..Range(.Cells(1, 2), .Cells(intLastRow, intLastCol + 1)).PasteSpecial 'I've
tried .Paste as well
End With

BUT the following which occurs later in the routine works fine:
With Workbooks("Benefits.xlsm").Worksheets(strMainSheet )
intMainLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
..Range(.Cells(intMainLastRow + 2, 1), .Cells(intMainLastRow + 2 +
intLastRow, intLastCol)).PasteSpecial
End With

When I try to isolate it into its own Macro, I get various errors such as
"object doesn't support property/method", yet this doesn't occur when I run
it with the rest of the code.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA Coding for Printing Varne Excel Discussion (Misc queries) 4 July 24th 08 04:48 PM
Help with my coding problem? Dan the Man[_2_] Excel Worksheet Functions 3 September 11th 07 12:02 AM
Can Excel do this with coding? Dan the Man[_2_] Excel Worksheet Functions 6 August 10th 07 03:44 PM
help with coding in excel associates Excel Worksheet Functions 3 June 7th 06 10:41 AM
First attempt at VBA coding problem Rick in NS New Users to Excel 9 January 12th 06 05:11 PM


All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"