LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Define range with activecell

Hi all

Trying to write a sub to copy a row to a new row directly below

Receiving this error
Run-time error '1004':
PasteSpecial method of Range class failed
Unsure as to why
Seems should work
Also appreciate any commentary to restructure the code if any ideas to
make it beeter more effifcient (example, hard coded column IV (230).
What happend if hidden? What happens when Excel 12 is released? 16K
Columns.

Thanks much
-goss

Sub RowCopy()

'Copy current row to next row
'Preserve formats and formulas
'marc
'April 25, 2006

Dim rngCopy As Range
Dim rngDestination As Range

With Application
.ScreenUpdating = False
.DisplayAlerts = False
.Calculation = xlCalculationManual
End With

ActiveCell.End(xlToLeft).Select
Set rngCopy = Range(ActiveCell, ActiveCell.Offset(0, 230))
rngCopy.Copy
Application.CutCopyMode = False
ActiveCell.End(xlToLeft).Select
Set rngDestination = Range(ActiveCell.Offset(1, 0), ActiveCell(1, 230))
With rngDestination
.PasteSpecial xlPasteFormats
.PasteSpecial xlPasteFormulasAndNumberFormats
End With

'Cleanup
Set rngCopy = Nothing
Set rngDestination = Nothing

With Application
.CutCopyMode = True
.DisplayAlerts = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub

 
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
ActiveCell in a Range? Filo Excel Discussion (Misc queries) 3 May 22nd 07 09:52 PM
select range next to activecell lookin Excel Programming 3 March 29th 06 07:56 PM
Select Activecell in Range PraxisPete Excel Programming 0 June 1st 05 01:23 PM
Name of range containing ActiveCell? Ed Excel Programming 13 January 4th 05 12:55 AM
Saving the activecell range for later use Tim Coddington Excel Programming 0 December 12th 04 09:12 PM


All times are GMT +1. The time now is 08:45 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"