Paste Variable

cccbzg

Board Regular
Joined
Oct 5, 2014
Messages
68
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to copy and paste certain rows from one worksheet to another. I've got that to work - hallelujah! Now, in that same row, I'm trying to output 3 variable fields which I've saved from rows above. My variable fields come out one row below my pasted fields. What to do? I think once the Offset runs, it moves down a row, but I can't seem to figure how to code it differently.

Many thanks,
Bonnie


Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Summary Sheet")
Set pasteSheet = Worksheets("Your Dates")
Application.ScreenUpdating = False
copySheet.Range("A" & i & ":M" & i).Copy


With pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1)
.PasteSpecial xlPasteValues
.PasteSpecial xlFormats

ActiveRO = ActiveCell.row
pasteSheet.Range("E" & ActiveRO) = CsaveDAYS
pasteSheet.Range("F" & ActiveRO) = CsaveMESSAGE
pasteSheet.Range("A" & ActiveRO) = CsaveDATE

End With
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Does this work?
Code:
With pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1)
    .PasteSpecial xlPasteValues
    .PasteSpecial xlFormats

    ActiveRO = .Row
    pasteSheet.Range("E" & ActiveRO) = CsaveDAYS
    pasteSheet.Range("F" & ActiveRO) = CsaveMESSAGE
    pasteSheet.Range("A" & ActiveRO) = CsaveDATE

End With
 
Upvote 0
OMGoodness YES...IT WORKS!

So what is the difference? Between .Row and ActiveCell.row?

Thanks SO Very much!
 
Upvote 0
ActiveCell.Row will give you the row of, well, the active cell.

.Row will give you the row of the range in the With statement, i.e. pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1).
 
Upvote 0
ActiveCell.Row will give you the row of, well, the active cell.

.Row will give you the row of the range in the With statement, i.e. pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1).




Thanks SO much.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top