szita2000
Board Regular
- Joined
- Apr 25, 2012
- Messages
- 101
- Office Version
- 365
- Platform
- Windows
Hi guys.
I am trying to replace a copy/paste special with setting the value of a range to the values of another, but I can't work it out.
I receive no error message, but the values not getting written in to my rgto range
This is where I am at the moment: The last few lines are the ones not working.
Just thinking out loud. But ...
Is my problem that the valules are not loaded in to an array with the () operator?
Wonder if that is the solution to say the rngto = arr().
I am trying to replace a copy/paste special with setting the value of a range to the values of another, but I can't work it out.
I receive no error message, but the values not getting written in to my rgto range
This is where I am at the moment: The last few lines are the ones not working.
Just thinking out loud. But ...
Is my problem that the valules are not loaded in to an array with the () operator?
Wonder if that is the solution to say the rngto = arr().
VBA Code:
Sub ArchiveThisLine()
Dim b As Range
Dim lrto As Long, rgSource As Range, rgTo As Range
Application.EnableEvents = False
lrto = Sheet25.Range("A" & Rows.Count).End(xlUp).Row
'Getting the Cell
Set b = ActiveSheet.Buttons(Application.Caller).TopLeftCell
'Set Cell value to nothing (There is a 1 placed there so we won't make hundreds of buttons if there are a button there already
b.Value = ""
'Copy the Name, Gépegység, Veszteség (Because they merging cells. - Bastards. )
Set rgSource = Sheet23.Range(Cells(b.Row, 2), Cells(b.Row, 4))
Set rgTo = Sheet25.Range("A" & lrto + 1)
On Error GoTo CustLabel
rgSource.Value = rgTo.Resize(1, rgSource.Columns.Count).Value
On Error GoTo 0
' rgSource.Copy
' rgTo.PasteSpecial xlPasteValues