ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Another coping and pasting macro (https://www.excelbanter.com/excel-programming/332610-another-coping-pasting-macro.html)

Jennifer

Another coping and pasting macro
 
My feable attempt at writing this. Very apperent to me that i need more help.
I have a worksheet (GwrStmts.) with a named range GwrStmt that I would like
to copy and paste on Worksheet ("GrowerDatabase") a row after the last entry.
What am i missing? Thank you once again. Jennifer

Sub PostGwrStmt()
With Worksheets("GwrStmts.")
Range("GwrStmt").Copy
End With
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GrowerDatabase")

' find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
Range("GwrStmt").PasteSpecial Paste:=xlPasteFormulasAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("GwrStmts.").Select
End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer

Toppers

Another coping and pasting macro
 
Hi(again!),

Sub PostGwrStmt()

Dim iRow As Long
Dim ws As Worksheet

Set ws = Worksheets("GrowerDatabase")

' find first empty row in database

iRow = ws.Cells(Rows.Count, 1) .End(xlUp).Offset(1, 0).Row

Worksheets("GwrStmts").Range("GwrStmt").Copy ws.Cells(iRow, 1)

End Sub


HTH

"Jennifer" wrote:

My feable attempt at writing this. Very apperent to me that i need more help.
I have a worksheet (GwrStmts.) with a named range GwrStmt that I would like
to copy and paste on Worksheet ("GrowerDatabase") a row after the last entry.
What am i missing? Thank you once again. Jennifer

Sub PostGwrStmt()
With Worksheets("GwrStmts.")
Range("GwrStmt").Copy
End With
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GrowerDatabase")

' find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
Range("GwrStmt").PasteSpecial Paste:=xlPasteFormulasAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("GwrStmts.").Select
End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer



All times are GMT +1. The time now is 05:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com