-
Oct 18th, 2018, 08:51 AM
#1
Thread Starter
New Member
[RESOLVED] VBA error - please help
Hi guys,
Please can someone help me with my code below?I'm quite new, so not sure where is the issue.
I am trying to copy a Column in one sheet (the length of the column is not always the same so I am using "Rows.Count"), then select this range, copy it and paste special values on a specific cell of another sheet!
Many thanks in advance
Private Sub CommandButton1_Click()
Dim sh As Worksheet
Dim k As Integer
Dim rng1 As Range
Set sh = Worksheets("Sheet1")
k = sh.Range("A1", sh.Range("A9").End(xlDown)).Rows.Count
rng1.Value = Range(Cells(9, 1), Cells(k, 1)).Value
rng1.Select
Selection.Copy
Worksheets("Sheet2").Range("A2").PasteSpecial xlPasteValues
End Sub
-
Oct 18th, 2018, 11:25 AM
#2
Re: [RESOLVED] VBA error - please help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|