I have two sheets (sheet1 / Sheet2). Sheet2 contains random numbers where one random is selected and I would that last number generated to be copied to last row in Sheet1 Column I
I have tried various code
Sub passpop()
Dim v As Variant
Dim strPassword As String
With Worksheets("Sheet2")
v = .Cells(.Rows.Count, "A").End(xlUp).Value
.Cells(.Rows.Count, "A").End(xlUp).Cut .Cells(.Rows.Count, "B").End(xlUp)(2)
End With
With Worksheets("Sheet1")
Sheet1.Range("I13:I13") = v
End With
End Sub
Two way to copy paste:
Option Explicit
Sub Paste()
'Copy Paste with value and formatting
Sheet1.Range("A1").Copy Sheet2.Range("A1")
'Copy Paste only value
Sheet1.Range("A2").Copy
Sheet2.Range("A2").PasteSpecial Paste:=xlPasteValues
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.