question

PeterMarch-3048 avatar image
0 Votes"
PeterMarch-3048 asked emilyhua-msft commented

Inserting a set number of rows into an excel table based on the number in a specified cell

Hi,

I'd like to make an excel table the correct length by specifying its length in a Question box.

eg> A1: How many samples do you have? Answer in B1: 20
This would then add 20 rows to the table below to allow the user to add the details of all 20 samples. Alternatively if they said 30 it would add 30 rows.

The slight downside is that I have another table below this one which has more information in it and I don't want the enxtending table to overwrite any of this table. However, it would also be great to automatically adjust to the same length.

This seems like it should be simple, but I just can't find the answer online.

The ultimate goal would be:

Cell A1: How many samples do you have? Answer in Cell B1: 10
This would add 10 rows to table 1 (eg rows 3 to 13) AND 10 rows to table 2 (rows (15 to 25)

If the answer was 20 samples then this would add 20 rows to table 1 (eg rows 3 to 23) and 20 rows to table 2 (eg rows 25 to 45).

Hope that makes sense and there's a simple way to do it.

Thanks,

Peter

office-vba-devoffice-excel-itprooffice-scripts-excel-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @PeterMarch-3048
According to your description, your requirements need the code help.
To better help you, I added tag "office-vba-dev".
Thanks for your understanding.

0 Votes 0 ·

0 Answers