Delete row in two worksheet at same time

inactiveUser214710

Board Regular
Joined
Apr 27, 2012
Messages
171
Hi everyone
I have a userform, with a combobox, and from that I transfer data to a main worksheet(1)-(table),
but some especif data, depending on the kind of it, transfer as well to another worksheet(2).
This works well, but when I want to delete a especific data in determinate row in sheet1 it delete just in sheet 1 and didn't delete in worksheet2.
Are there any solution for this? How to use code vba to do that? Thank you
The code that I use to transfer to sheet2 is:
VBA Code:
[TABLE]
[TR]
[TD]Dim rng As Range[/TD]
[/TR]
[TR]
[TD]If cboP.Value = "Stones" Then[/TD]
[/TR]
[TR]
[TD]Set rng = Worksheets("sheet2").Cells(Rows.Count, "c").End(xlUp).Offset(1, 0)[/TD]
[/TR]
[TR]
[TD]rng.Offset(0, 3) = cboDesp.Value[/TD]
[/TR]
[TR]
[TD]rng.Offset(0, 4) = txtvt.Value[/TD]
[/TR]
[TR]
[TD]rng.Offset(0, 5) = txtob.Value[/TD]
[/TR]
[TR]
[TD]End If[/TD]
[/TR]
[/TABLE]
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
VBA Code:
Dim rng As Range    
     If cboP.Value = "Stones"  Then    
         Set rng = Worksheets("sheet2").Cells(Rows.Count,    "c").End(xlUp).Offset(1, 0)    
               rng.Offset(0, 3) = cboDesp.Value    
               rng.Offset(0, 4) = txtvt.Value    
               rng.Offset(0, 5) = txtob.Value    
     End If
 
Upvote 0

Forum statistics

Threads
1,214,846
Messages
6,121,905
Members
449,054
Latest member
luca142

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