Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Paste Method


Why is the following not valid?


Code
-------------------
Selection.EntireRow.Past
-------------------


To understand the code in context, I have just copied a row using th
EntireRow property and I am now pasting it into another row, except i
is not working. Anyone have any suggestions

--
Raman32
-----------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...fo&userid=2474
View this thread: http://www.excelforum.com/showthread.php?threadid=38322

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Paste Method


can you paste the complete cod

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38322

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Paste Method

Hard to be sure without seeing the code, but I suspect you are pasting into a
cell that is not in column A. If you are doing this it will fail since the
"entire row" contains cells (blank ones count!) that would have to be pasted
beyond the upper limit of the worksheet columns. This happens if you do it
manually, too (select a row, copy, and paste into a cell in B and you will
see).

If this is indeed the reason it fails, paste into the destination cell's
..EntireRow and it should work.

"Raman325" wrote:


Why is the following not valid?


Code:
--------------------
Selection.EntireRow.Paste
--------------------


To understand the code in context, I have just copied a row using the
EntireRow property and I am now pasting it into another row, except it
is not working. Anyone have any suggestions?


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=383224


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Paste Method


Sure. The purpose of the macro is to import data from one workbook to
the other. The problem is one workbook has extra lines in between the
different headers (the headers and sections for each part of the Excel
file have already been added and the content just needs to be put in
there). Sorry if that's confusing, heres the code:


Code:
--------------------
Public Sub Import()
Static baseBook As Workbook
Static myBook As Workbook
Static i1 As Long
Static i2 As Long

Set baseBook = ThisWorkbook
Set myBook = Workbooks("report.xls")

bNumber = Application.InputBox("What is the week number?", "Week Number", Type:=1)

i1 = myBook.ActiveSheet.Range("C1", "C" & myBook.ActiveSheet.UsedRange.SpecialCells(xlCellTy peLastCell).Row).Find(bNumber).Row - 2
i2 = myBook.ActiveSheet.Rows.Count
' basePos = baseBook.Selection.Row
basePos = 16
Application.ScreenUpdating = False

For a = 1 To 7 Step 1
baseBook.Worksheets("NCA-" & a).Activate
Do
myBook.Activate
myBook.ActiveSheet.Cells(i1, "J").Select
If Selection.Interior.ColorIndex = 2 Or (Not Selection.Interior.ColorIndex = 20 And Not Selection.Interior.ColorIndex = 37 And Not Selection.Interior.ColorIndex = 36) Then
Selection.EntireRow.Select
Selection.Copy
baseBook.Activate
baseBook.ActiveSheet.Cells(basePos, "H").Select
Selection.EntireRow.Paste
Else
Set rngFindRange = baseBook.ActiveSheet.Range("H" & basePos, "BE" & baseBook.ActiveSheet.UsedRange.SpecialCells(xlCell TypeLastCell).Row)
Set rngFoundCell = rngFindRange.Find(Selection.Value, LookIn:=xlValues, searchorder:=xlByRows)
basePos = rngFoundCell.Row
End If
i1 = i1 + 1
basePos = basePos + 1
Loop Until i1 i2 Or myBook.ActiveSheet.Cells(i1, "J").Value = "BREAKFAST"
Next a
Application.ScreenUpdating = True
End Sub
--------------------


Thanks again for your help.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=383224

  #5   Report Post  
Posted to microsoft.public.excel.programming
jjk jjk is offline
external usenet poster
 
Posts: 42
Default Paste Method

The EntireRow property should work even if the Selection column is not
A.

I can think of one possibility where the EnitreRow can fail.
If the the row contains merged cells is some format. This would mean
that the paste action cannot change a part of the destination merged
cells.

However, it is tough to tell why without looking at the code and the
sheet layout.

Regards,
Jayant



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Paste Method


baseBook.ActiveSheet.Cells(basePos, "H").Select
Rows(Selection.Row & ":" & Selection.Row).Select
ActiveSheet.Paste


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=383224

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Paste Method


That fixed it Anil, thank you very much. I also appreciate the comments
and suggestions from jjk and K Dales.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=383224

Reply
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 you change the default paste method? (paste values) David A Brown Excel Discussion (Misc queries) 3 December 18th 07 09:59 AM
Paste method error in macro bwilk77 Excel Discussion (Misc queries) 2 October 25th 07 09:21 PM
Method 'Paste' of object '_Worksheet' failed markline Excel Discussion (Misc queries) 7 May 28th 05 05:02 AM
Cut and Paste using Macro gives paste special method error Lourens Pentz Excel Programming 3 November 21st 04 10:42 PM
Looking for faster method for Copy & Paste David Copp[_4_] Excel Programming 5 August 25th 04 04:32 AM


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