+ Reply to Thread
Results 1 to 2 of 2

Problem with range for copy paste

Hybrid View

  1. #1
    Registered User
    Join Date
    07-19-2017
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    1

    Problem with range for copy paste

    This works:-
     Worksheets("GSP raw data").Range("A1:C1").Copy Worksheets("Transposed GSP Data").Range("A1:C1")
    How do I make this to similar short? I am unable to make this work
     Sheets("GSP raw data").Range(Cells(iRow, 1), Cells(iRow, 3)).Copy  Sheets("Transposed GSP Data").Range( Cells(N1, 1))

    The selection.autofill also does not work if I do not specify the worksheets and cells.

    
    For iRow = 3 To O1
            
            Sheets("GSP raw data").Range(Cells(iRow, 1), Cells(iRow, 3)).Copy
            
            Sheets("Transposed GSP Data").Select
            N1 = Sheets("Transposed GSP Data").Cells(Rows.Count, 1).End(xlUp).Row + 1 ' find the last recent row to append data
                       
                        
                        NiRow = N1 + CLng(23) ' find the next "24" months to add new linr items (24 motnhs for 2 FY)
                        Cells(N1, 1).Select
                        ActiveSheet.Paste
    
                        Selection.AutoFill Destination:=Range(Cells(N1, 1), Cells(NiRow, 3)), Type:=xlFillDefault
      
                        
                        Application.CutCopyMode = False
                        
                        ' auto-fill the row information down for 24 months
                        Selection.AutoFill Destination:=Range(Cells(N1, 1), Cells(NiRow, 3)), Type:=xlFillDefault
    
                        
                        Application.CutCopyMode = False
    Thanks in advance

  2. #2
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Problem with range for copy paste

    DCould you please post a desensitized example of your workbook and how the code should work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help! - Copy Range (Sheet1,A10:F50), Paste Range (Sheet 2,A1:F41), Offset Range & Repeat
    By cjtimmer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-30-2015, 06:27 PM
  2. [SOLVED] Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem
    By LennartB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2015, 06:58 AM
  3. [SOLVED] Copy And Paste Range on diffrenct sheet Selection problem Solved by : sixthsense
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2014, 03:43 AM
  4. Copy/Paste range of data excluding certain rows and copy to another workbook
    By HoerbigAdm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2012, 02:51 PM
  5. Problem with Range,Selection, Copy and Paste
    By ljunggrenus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2007, 07:19 AM
  6. Replies: 3
    Last Post: 12-09-2005, 01:20 PM
  7. Replies: 1
    Last Post: 01-04-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1