Can i use Variables in sed command in line numbers

I wish to give line number from one point to another in sed command like this
sed -n 1,1000000p file1.txt >file2.txt
but variable line number $x,$x+100000 can i give it cos i tried and it was giving an error any suggestions?/
Thx in advance
AC

why not calculate the line numbers outside of the sed-script?

#! /bin/bash
typeset -i A=1 B=A+5
sed -n "${A},${B} p" file.txt

Print from x line to x+3 line.

sed -n $x,$((x+3))'p'  file