Hi....Hows what im trying accomplish
I have one worksheet that I enter inventory into. It has roughly 10 columns and 140 rows.
I want to copy only the rows with values > 0 to a next sheet ( the next sheet is for an invoice that will be printed so I want to display the data in a neat formatted way). A value greater than zero or an empty cell indicates that the user hasn't ordered anything and so the item should not be transferred to the inventory sheet.
I need the target sheet (i.e. the invoice sheet) to update to reflect any changes I make in the source sheet. For example if I change an item from 1 to 0 or nothing (i.e. cell is empty) I need the item to be removed from the target sheet but the target sheet must remain formatted neatly (I don't want the deleted item to leave a space indicating that something was once there. )
IN SUMMARY HERE'S WHAT I NEED TO DO:
1. TRANSFER VALUES FROM ONE SHEET TO ANOTHER. TARGET SHEET NEED TO USE IT OWN FORMAT.
2. FORMAT TAGET SHEET NEATLY
3. ANY MANIPULATION OF DATA ON SOURCE SHEET SHOULD BE REFLECTED ON TARGET SHEET.
4. DELETED DATA SHOULD NOT LEAVE SPACES.
here's what I tried which of course was useless. if I change the value of an item it doesn't delete correspondingly and doesn't me the criteria I previously stated above this line. Not sure if I need arrays to do this but here it is:
Public lastrow As Long
Public MyAddress As Variant
Private Sub Worksheet_Deactivate()
Call AppendData
End Sub
Sub AppendData()
Dim c As Range
Dim Datecount As Integer
loopCounter = 0
Dim xWorksheet As Worksheet
Set xWorksheet = Sheet3
For Each c In Worksheets("Mon. & Tues. SmallWares").Range("G6:N60").Cells
If Not c.Value < 1 Then
MyAddress = c.Row
Call LastRowWithDataOnTargetSheet
Call UpdateTargetSheet
loopCounter = loopCounter + 1
End If
Next
End Sub
Sub LastRowWithDataOnTargetSheet()
lastrow = Sheet3.Cells(Rows.Count, "C").End(xlUp).Row
'MsgBox LastRow
End Sub
Sub UpdateTargetSheet()
'increment the last row to get the insert position
lastrow = lastrow + 1
Sheets("Mon. & Tues. SmallWares").Rows(MyAddress).Copy Sheets("Mon. & Tues. Order").Rows(lastrow)
End Sub
Bookmarks