• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help on Dynamic Copy to Other Sheet of same workbook

Manan

New Member
Hi all,

I have below code but it is throwing the errors , can some one help me out on this , all i am doing is copying the data from H14 till Oxx where xx is dynamic and pastin git in sheet2 starting from cell A. below is code.

Code:
Sub DynCopy()
'
' DynCopy Macro
'
'
  Dim srtRng As Long
  srtRng = Range("H" & Rows.Count).End(xlUp).Row
  Sheets("Sheet1").Columns("H14:O" & srtRng).Copy Sheets("Sheet2").Columns("A:E").Paste
End Sub
 
You are not copying an entire column, nor giving a column number. Additionally, when you give the optional destination as part of the Copy method, don't add Paste to the end. Change to:
Code:
Sub DynCopy()
'
' DynCopy Macro
'
'
Dim srtRng As Long
  srtRng = Range("H" & Rows.Count).End(xlUp).Row
  Sheets("Sheet1").Range("H14:O" & srtRng).Copy Sheets("Sheet2").Range("A1")
End Sub
 
Back
Top