Note that there are some explanatory texts on larger screens.

plurals
  1. POHow fill in the next row of a list in a spreadsheet using a macro?
    text
    copied!<p>I need to write a spreadsheet which when you press a button adds a row of data and asks for the parameters needed for the calculations, but I cant seem to get it to fill in the data in the next row down? I am a complete begginner to macros in excel and have only done very basic programming for matlab on my uni course. My script so far is as follows:</p> <pre><code>Sub AddPosTol() ' AddPosTol Macro Dim rngSeek As Range Set rngSeek = Range("B1") While rngSeek &lt;&gt; "" 'If the cell isn't empty, drop down one row: rngSeek = rngSeek.Offset(1, 0) End With rngSeek.Offset(0, 1) With .Font .Name = "Solid Edge ANSI1 Symbols" .Size = 11 .Value = 1 End With &lt;--added this End With 'don't need to call Range() around rngSeek - it is already a range type rngSeek.Offset(0, 3) = "=RC[-1]" rngSeek.Offset(0, 4) = "0" With rngSeek.Offset(1, 1) .Font.Bold = True &lt;--don't really need a With if only one statement End With 'can use a With statement here if you want: With rngSeek .Offset(1, 1) = "X value" .Offset(2, 1) = "Y Value" .Offset(0, 4) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)" .Offset(0, 5) = "=2*SQRT((R4C3-R[1]C)^2+(R5C3-R[2]C)^2)" .Offset(0, 6) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)" .Offset(0, 7) = "=2*SQRT((R[1]C[-3]-R[1]C)^2+(R[2]C[-3]-R[2]C)^2)" .Offset(0, 8) = "=2*SQRT((R4C3-R[1]C)^2+(R5C3-R[2]C)^2)" .Offset(0, 2) = (InputBox("Insert Positional Tolerance Diametre")) .Offset(1, 2) = (InputBox("Insert X value on drawing")) .Offset(2, 2) = (InputBox("Insert Y value on drawing")) End With End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload