Hi All, am new to the Board, hoping someone may help me please.
I have written VBA here and there, and have automated a journal creation and export to csv, but this below prob for the life of me, can't get it to do what I want.
Image of an example "Data" Sheet attached, based on the number of rows with data counted between C3:C16 (in this example 11), I want to copy the row of formulas in Row 18 across the columns down from Row 19 for the number of Rows counted between C3:C16. I have tried the following simple code, at first appeared to work, but when reran it, it every time copies the formulas all the way to the last row.
Sub test()
nrows = Sheets("Data").Cells(Rows.Count, 3).End(xlUp).Row
Sheets("Data").Rows("18:18").Copy
Sheets("Data").Rows("19:19" & nrows).Select
ActiveSheet.Paste
End Sub
I have tried various other variations, as well as trying to build a CountIf into the code, to no avail.
Would appreciate some assistance. As I say, my VBA is basic at best.
Cheers
Gary
I have written VBA here and there, and have automated a journal creation and export to csv, but this below prob for the life of me, can't get it to do what I want.
Image of an example "Data" Sheet attached, based on the number of rows with data counted between C3:C16 (in this example 11), I want to copy the row of formulas in Row 18 across the columns down from Row 19 for the number of Rows counted between C3:C16. I have tried the following simple code, at first appeared to work, but when reran it, it every time copies the formulas all the way to the last row.
Sub test()
nrows = Sheets("Data").Cells(Rows.Count, 3).End(xlUp).Row
Sheets("Data").Rows("18:18").Copy
Sheets("Data").Rows("19:19" & nrows).Select
ActiveSheet.Paste
End Sub
I have tried various other variations, as well as trying to build a CountIf into the code, to no avail.
Would appreciate some assistance. As I say, my VBA is basic at best.
Cheers
Gary