ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Complicated insert / drag formulas (https://www.excelbanter.com/excel-discussion-misc-queries/113252-complicated-insert-drag-formulas.html)

Ed

Complicated insert / drag formulas
 
Hello I have a format which is 7 columns and 59 rows long (column A is hidden
all the time so that makes 6 visible), what I need to edit is from row 19
on. So starting on Row 19 I have a couple of formulas in that row, those
formulas I drag them down with the following macro:

Option Explicit
Sub DragIndexVertical()
Dim LastRow As Long
With ActiveSheet
LastRow = .Range("B1").Value
Range("b19:f" & LastRow).FillDown
End With
End Sub

So what I need is to add lines to that code to add the following:

In this case the value in B1 gives me 4 more rows so this code generates
from Row 19 - 23.

Row24: I need to have a blank row
Row25: C25=Sheet1!G24, F25=Sheet1!H24
Row26: C26=Sheet1!G25, F26=Sheet1!H25
Row27: Blank row
Row28: C28=Sheet1!G27, F28=Sheet1!H27
Row29: Blank row
Row30: Blank row
Row31: "text written in here"
Row32 - 51: Blank rows

Note: this ahead I didn't come up with any better way to do it, any
suggestion is welcome!

Row52: "Sincerely" (Merge and Center B:F)
Row53: Blank row
Row54: "______________________" (Merge and Center B:F)
Row55: =Sheet2!B1 (Merge and Center B:F)
Row56 - 59: Blank rows

Ok so those are the 59 rows, the complicated thing in here is that in this
case the value of B1 on the code above adds me 4 extra rows with data but if
I would have had 15 for example, not everything would fit in the sheet of
paper. The "Sincerely" and all that afterwards would be left outside, it
would be REALLY nice if instead of adding Row 32-51 in blank by default, it
would add the result of substracting the resulting from the code above from
59, anyways maybe that is too much, at least with the above I would be happy
with the code, i don't mind adding / deleting rows at the end!

thanks for your time


All times are GMT +1. The time now is 12:23 AM.

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