Excel help please

abdulkharij

New Member
Joined
Feb 26, 2015
Messages
30
Hi evryone,</SPAN>
I have the following table in sheet-1 from an excel workbook. I want an excel formula that can allow me to automatically add a row to similar table in sheet-2 if I add it to the main table in sheet-1.</SPAN>
Example: If I add a row with the name "Jane" in sheet-1 it should automaticaly be added to similar table in sheet-2</SPAN>
Name</SPAN>Hours</SPAN>Rate</SPAN>Total</SPAN>
jhon</SPAN>35</SPAN>10</SPAN>350</SPAN>
David</SPAN>20</SPAN>11</SPAN>220</SPAN>
Mark</SPAN>50</SPAN>12</SPAN>600</SPAN>
Hellen</SPAN>40</SPAN>11</SPAN>440</SPAN>
Iren</SPAN>40</SPAN>13</SPAN>520</SPAN>
Nicole</SPAN>39</SPAN>14</SPAN>546</SPAN>
Thank you,</SPAN>

<TBODY>
</TBODY><COLGROUP><COL span=4></COLGROUP>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi abdulharij,

Maybe something like this, goes in the sheet 1 code module.

Howard

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 4 Then Exit Sub
If Target.Count > 1 Then Exit Sub

Dim cols As Range
Dim colRow As Long
colRow = Target.Row

Set cols = Sheets("Sheet1").Range(Cells(colRow, 1), Cells(colRow, 4))

If Application.WorksheetFunction.CountA(cols) = 4 Then
  cols.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
End If
End Sub
 
Upvote 0
Just to add, should you want values only, and you have formulas on sheet 1.

Howard

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 4 Then Exit Sub
If Target.Count > 1 Then Exit Sub

Dim cols As Range
Dim colRow As Long
colRow = Target.Row

Set cols = Sheets("Sheet1").Range(Cells(colRow, 1), Cells(colRow, 4))

If Application.WorksheetFunction.CountA(cols) = 4 Then
  cols.Copy
  Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,393
Members
449,446
Latest member
CodeCybear

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