Copy data from textboxes on userform to specific range , if not create range before copy

tubrak

Board Regular
Joined
May 30, 2021
Messages
218
Office Version
  1. 2019
Platform
  1. Windows
Hi
I create ranges manually contain some formulas

data in sheett
tb.xlsm
ABCDEF
1ITEMNAMEINVOICE NODEBITCREDITBALANCE
20.00
30.00
4TOTAL0.000.000.00
5
6
7
8ITEMNAMEINVOICE NODEBITCREDITBALANCE
90
100
11TOTAL000
12
13
14ITEMNAMEINVOICE NODEBITCREDITBALANCE
150
160
17TOTAL000
s
Cell Formulas
RangeFormula
F2,F17,F15,F11,F9,F4F2=D2-E2
F3,F16,F10F3=F2+D3-E3
D17:E17,D11:E11,D4:E4D4=SUM(D2:D3)

so when fill the userform
in1.JPG

should search for empty range doesn't contain name in column B then result will be in first range like this
tb.xlsm
ABCDEF
1ITEMNAMEINVOICE NODEBITCREDITBALANCE
21TUBERA3332,000.00100.001,900.00
31,900.00
4TOTAL2,000.00100.001,900.00
5
6
7
8ITEMNAMEINVOICE NODEBITCREDITBALANCE
90
100
11TOTAL000
12
13
14ITEMNAMEINVOICE NODEBITCREDITBALANCE
150
160
17TOTAL000
s
Cell Formulas
RangeFormula
F2,F17,F15,F11,F9,F4F2=D2-E2
F3,F16,F10F3=F2+D3-E3
D17:E17,D11:E11,D4:E4D4=SUM(D2:D3)


fill again form
in2.JPG

result will be
tb.xlsm
ABCDEF
1ITEMNAMEINVOICE NODEBITCREDITBALANCE
21TUBERA3332,000.00100.001,900.00
32TUBERA3341,000.002,900.00
4TOTAL3,000.00100.002,900.00
5
6
7
8ITEMNAMEINVOICE NODEBITCREDITBALANCE
90
100
11TOTAL000
12
13
14ITEMNAMEINVOICE NODEBITCREDITBALANCE
150
160
17TOTAL000
s
Cell Formulas
RangeFormula
F2,F17,F15,F11,F9,F4F2=D2-E2
F3,F16,F10F3=F2+D3-E3
D17:E17,D11:E11,D4:E4D4=SUM(D2:D3)


fill again on form

in3.JPG



result should insert new row before TOTAL row with the same formatting and formulas
tb.xlsm
ABCDEF
1ITEMNAMEINVOICE NODEBITCREDITBALANCE
21TUBERA3332,000.00100.001,900.00
32TUBERA3341,000.002,900.00
43TUBERA3352,000.00900.00
5TOTAL3,000.00100.002,900.00
6
7
8ITEMNAMEINVOICE NODEBITCREDITBALANCE
90
100
11TOTAL000
12
13
14ITEMNAMEINVOICE NODEBITCREDITBALANCE
150
160
17TOTAL000
s
Cell Formulas
RangeFormula
F2,F17,F15,F11,F9,F5F2=D2-E2
F16,F10,F3:F4F3=F2+D3-E3
D5:E5D5=SUM(D2:D3)
D17:E17,D11:E11D11=SUM(D9:D10)


if I select new name then use next range doesn't contain name in column B , if there is no more range is empty based on column B then should create range based on last range to fill by new name
thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,221,526
Messages
6,160,340
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top