I realize this is probably a very basic question, but I'm struggling to find the answer online. Thank you in advance!
I am very new to VBA and trying to write a macro to speed up my workflow, having difficulty finding a code that will drag down a variable amount of rows.
Sheet 1 with lots of information about samples - I add new samples to this one with a form
Sheet 2 has a space to enter results with replicates for each sample.
I want my macro select all the data on Sheet 2, calculate the difference between the last cell in Sheet 1 Column A and Sheet 2 Column E, and drag down by double that amount to skip rows as I have in the images below.
My idea of how the code would work:
I am very new to VBA and trying to write a macro to speed up my workflow, having difficulty finding a code that will drag down a variable amount of rows.
Sheet 1 with lots of information about samples - I add new samples to this one with a form
Sheet 2 has a space to enter results with replicates for each sample.
I want my macro select all the data on Sheet 2, calculate the difference between the last cell in Sheet 1 Column A and Sheet 2 Column E, and drag down by double that amount to skip rows as I have in the images below.
My idea of how the code would work:
VBA Code:
Sub Update()
'Call Value of Last Cell Sheet 1 Column A = "x"
???
'Call Value of Last Cell Sheet 2 Column E = "y"
???
'Calculate Number of cells to drag down "n" = (x - y)*2
???
'Select Cells in Sheet 2
Sheets("Sheet 2").Select
Range("E4", Range("E4").End(xlDown).End(xlToRight)).Select)
'Drag Down by "n"
???
End Sub