LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default copy paste methods.....

Ok,
seeing that none of the fixes offered thus far have succeeded, I'd like to
ask the following. And yes, I've tried them all-- two or three different
ways. I've gotten 438 errors, 1004 errors, and Stuart's version resulted in
my cells to unmerge. And this was why I wanted to create the macro to begin
with-- so I could copy, and prevent all the properties of a cell group of
coming over to the destination.

With other macros that I've made in which I used the range.select,
selection.copy, activesheet.paste, they've worked as written.

So it seems to me that it's got to be something preceeding what I've used.

The only thing that I can think of that might cause problems is my use of the

application.inputbox().cells(1), or application.inputbox().areas(1)

I've tried both, and neither works with the activesheet.paste. Thus leaving
me thinkingthat it was my .paste use, and now it's got me wondering if the
application.inputbox is the cause.


Admittedly, none of my previous macros using the .copy, and .paste had
interactive input options. So.... what have I missed here that is causing the
activesheet.paste to fail?

Again, thank you for your helps.

Sub copyNmDwn()
Dim myRng1 As Range
Dim myRng2 As Range

Set myRng1 = Nothing
On Error Resume Next
Set myRng1 = Application.InputBox(Prompt:="Select cell range you wish to
copy from", Type:=8).Areas(1)

On Error GoTo 0

If myRng1 Is Nothing Then
Exit Sub 'user hit cancel.
End If

myRng1.Select
Selection.Copy

Set myRng2 = Nothing
On Error Resume Next

Set myRng2 = Application.InputBox(Prompt:="Select cell or range you want it
pasted to.", Type:=8).Areas(1)
On Error GoTo 0

If myRng2 Is Nothing Then
Exit Sub 'user hit cancel.
End If

myRng2.Select

With Selection
.Paste
End With


Application.ScreenUpdating = False

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
End With
'set right border when at dual vertical lines.
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
End With
'set bottom border if at page boundary
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
'set top border if at page boundary
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
End With
'set Left border for sake of it all....
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
End With
Application.ScreenUpdating = True
End Sub

Your helps are immensely appreciated.

 
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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM


All times are GMT +1. The time now is 03:56 AM.

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"