ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to insert copy and insert formulas only to next blank row (https://www.excelbanter.com/excel-programming/365932-macro-insert-copy-insert-formulas-only-next-blank-row.html)

bob

Macro to insert copy and insert formulas only to next blank row
 

I have a form with data on ws2 that is transferred to ws1 with
completed. When copied to ws1, it is copied to first empty row based
on the content of column 3.


To accomplish, I have used the following code to find first empty row
and then begin to copy data to that row.


===========================


'find first empty row in database
CellRow = ws1.Cells(Rows.Count, 3) _
.End(xlUp).Offset(1, 0).Row


'copy the data to the ws1
ws1.Cells(CellRow, 3).Value = ws2.[E4].Value
ws1.Cells(CellRow, 4).Value = ws2.[E15].Value
etc..............

==============================

Problem:

Rows 1 thru 255 of ws1 have data in them and row 256 is found by code
to be the "first empty row." Also have a few formulas in several
columns of ws1 in the 255 rows.

Before copying from ws2 to ws1, I would then want to copy row 255,
formulas only, to row 256. Row 256 would still be chosen as first
empty row because column 3 of 256 would still be blank.
I am at row 255 with formulas because of typical copy/paste, but would
like to do automatically with macro.


Thanks






All times are GMT +1. The time now is 01:37 AM.

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