Below is an excerpt from a workbook I am attempting to build. I have been trying to automate the population of the correct range of rows in column F based on data input into columns B, C and D. The data in this example is manually entered to demonstrate my desired results.
Knowing each row will always be in 15 minute increments, with cell F7 selected, I would like to populate the correct number of rows including and below F7 with the T. Basal units based on the T. Basal % change (column C) multiplied by the Basal interval units (column B). Specifically, in this example, reduce 0.05 by 50% in 8 total rows (2 hours divided by 15 minute increments), rows 7 through 14.
Knowing the starting cell will change within column F and the inputs in columns B, C and D will also change, I would ideally like the code to look to the inputs, adjust the value and cell range appropriately and enter the values. I have tried multiple times and my minimal knowledge of VBA has only led to frustrating failure (Waa, waa, waa!). Any help is greatly appreciated. Even just a start.
Thanks,
Harry
[TABLE="width: 598"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date and Time[/TD]
[TD]Basal[/TD]
[TD]T. Basal[/TD]
[TD]T. Basal Time[/TD]
[TD]T. Basal Time[/TD]
[TD]T. Basal[/TD]
[TD]Basal Net[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]mm/dd/yy hh:mm AM/PM[/TD]
[TD]interval units insulin[/TD]
[TD]% change[/TD]
[TD]hours[/TD]
[TD]days[/TD]
[TD]units Insulin[/TD]
[TD]units Insulin[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]07/87/2018 9:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]07/87/2018 10:00 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]07/87/2018 10:15 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]07/87/2018 10:30 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]07/87/2018 10:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD="align: right"]-50%[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0.083333333[/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]07/87/2018 11:00 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]07/87/2018 11:15 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]07/87/2018 11:30 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]07/87/2018 11:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]07/87/2018 12:00 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]07/87/2018 12:15 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]07/87/2018 12:30 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]07/87/2018 12:45 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]07/87/2018 1:00 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]07/87/2018 1:15 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
</tbody>[/TABLE]
Knowing each row will always be in 15 minute increments, with cell F7 selected, I would like to populate the correct number of rows including and below F7 with the T. Basal units based on the T. Basal % change (column C) multiplied by the Basal interval units (column B). Specifically, in this example, reduce 0.05 by 50% in 8 total rows (2 hours divided by 15 minute increments), rows 7 through 14.
Knowing the starting cell will change within column F and the inputs in columns B, C and D will also change, I would ideally like the code to look to the inputs, adjust the value and cell range appropriately and enter the values. I have tried multiple times and my minimal knowledge of VBA has only led to frustrating failure (Waa, waa, waa!). Any help is greatly appreciated. Even just a start.
Thanks,
Harry
[TABLE="width: 598"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date and Time[/TD]
[TD]Basal[/TD]
[TD]T. Basal[/TD]
[TD]T. Basal Time[/TD]
[TD]T. Basal Time[/TD]
[TD]T. Basal[/TD]
[TD]Basal Net[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]mm/dd/yy hh:mm AM/PM[/TD]
[TD]interval units insulin[/TD]
[TD]% change[/TD]
[TD]hours[/TD]
[TD]days[/TD]
[TD]units Insulin[/TD]
[TD]units Insulin[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]07/87/2018 9:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]07/87/2018 10:00 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]07/87/2018 10:15 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]07/87/2018 10:30 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]07/87/2018 10:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD="align: right"]-50%[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0.083333333[/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]07/87/2018 11:00 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]07/87/2018 11:15 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]07/87/2018 11:30 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]07/87/2018 11:45 AM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]07/87/2018 12:00 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]07/87/2018 12:15 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]07/87/2018 12:30 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.0250[/TD]
[TD="align: right"]0.025[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]07/87/2018 12:45 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]07/87/2018 1:00 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]07/87/2018 1:15 PM[/TD]
[TD="align: right"]0.0500[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0.05[/TD]
[/TR]
</tbody>[/TABLE]